In Drupal, usually the date field value is saved in the database in UTC timezone format. One of our requirements for a project was to show the date in the site's timezone format. So we generated a general function to convert date in UTC timezone to any required timezone and format it. Just use the below function to convert date in UTC timzone to a given timezone and the format date using a valid timestamp,
As part of a project requirement, we needed to notify users whenever an entity got created, updated, rated, or reviewed. Drupal's 'message' module fulfills this requirement. We can log and display messages and can even customize the notifier plugins. For creating a notification, we need to install the following modules: message message_notify message_subscribe The dependent modules are:
Have you been trying to index your node to Apache immediately after its been created, updated or deleted! Read On!! By default Apache Solr uses a queue system to index data to Solr. We can preconfigure the interval in which the indexing should perform. Still, there occurs a delay for the node to get indexed.
Most often we may want to show our custom forms in blocks. Here are the simple steps to accomplish this. In the below code we will create a form called “MymoduleExampleForm” and this form will be placed in a custom block called “MymoduleExampleBlock”. Step 1 – Create a custom module say 'mymodule'. For details on how to create a custom module in Drupal 8 See here Step 2 – Create a php file named MymoduleExampleForm.php in mymodule/src/Form and place the following code.
In Drupal 8 we can load an image using image style in a custom function using the file id of the image. For this first, we have to create an image style by configuration or create a config file for the same (Example below: image.style.sample_image_style.yml). Note that we can generate the below file after creating an image style and export the same from config synchronization in Drupal 8.
Remember a very popular game which came out some years back and caused ripples of excitement for at least some months - yes, you guessed it right, it was Pokemon Go. With the user’s smartphone and camera, the game turned the real world into an augmented reality world which included Pokemon. Augmented Reality (AR) is an interesting field, just like Artificial Intelligence and if you think it is only meant for games, then think again!
Patternlab is a dynamic organizational and prototyping tool for Drupal theming. By theming with pattern lab, your custom theme allows us to manage and build components in accordance with the required workflow using atomic design concepts1. Using Pattern Lab for Drupal 8 Theming Instead of rendering default Drupal templates, we can introduce pattern lab to include twig files using atomic concepts. It allows us to include external twig files by overriding the specific templates.
Kraftwagen is an Open Source deployment tool that is built entirely on top of Drush. Kraftwagen makes Drupal “easy to use” for developers, who customize Drupal extensively, need staged deployments, and use version control systems to collaborate. It provides a set of commands for 'drush make' based Drupal development workflow.Benefits of using Kraftwagen for security updates By using Kraftwagen to deploy security updates, the benefits are multifold, which include
[SOLVED] How to Uncheck 'Generate Automatic URL Alias' Option for All Node Editing Form by Configuration in Drupal 7?
In one of my work, there was a requirement to uncheck the option for 'Generate automatic url alias' checkbox for all nodes. I used the Pathauto module with version 7.x-1.2 for handling standard urls in the site. When changing a node title, its URL automatically changes. In case one forgets to uncheck the option 'Generate automatic url alias' in the node editing form, you can uncheck the option with the following steps:
HubSpot CRM manage sales processes of organizations. We can create contacts, company, leads, tasks using direct HubSpot CRM UI or using APIs provided by HubSpot. Here we are going to look at the APIs to create, update and delete companies. Create a Company This API is useful when we are integrating HubSpot with other site. https://api.hubapi.com/companies/v2/companies?hapikey=demo&portalId=62515 Required Parameters to send Request
For a recent project, I had a requirement to implement menu tabs in Drupal 7. Let see what are the necessary code for the same. First I created menu tabs in .module file using hook_menu() with the following codes.
A patch is a small file which shows what was changed in a repository. It shows the new changes in an existing file, details of the new files in the current directory, file deletion details etc. A patch file can be pushed to the git repository so that it is useful in the future for updating the changes in the corresponding file. For creating a patch file in your current git repository, make changes in your files. Now open the terminal. For unstaged changes, type the following command,
To render a Drupal form to a node, drupal_build_form function is used. This function allows us to render all forms except the admin forms. Note that, admin forms didn't find success while rendering the same. In-order to render a form the following syntax is used,
In this article I will be explaining how to create a custom media gallery functionality using the library Fancybox. First step is to create the content type 'Media Gallery(media_gallery)' and add the following fields in page 'admin/structure/types/manage/media_gallery/fields'
For a recent Drupal project there was a requirement to find the pages that a user visits on the site and send that to Google Analytics. Here, first we should save the page links that the user visits. But for this we need,
I came across a situation in my recent project, where user roles other than admin have to access the admin pages. The default admin theme was not provided for the admin pages in which the user role is not admin. Drupal has a module which allows us to add the admin theme to specific pages irrespective of the user role. Below are the steps which I followed to achieve this.
Developments in machine learning have a great influence on the e-commerce sector. Online purchase is steadily on the rise, allowing companies to capture all kinds of data on the customer experience, including
Administration Menu Source module is used to display different menus based on the roles existing in the system. This module is only available in Drupal 7. We can install the module using the following steps : Installation
Views query alter is used to edit the query in views that we created using Drupal. In cases where we cannot add fields in views, we can use hook_views_query_alter to change the query in views.