Before we discuss on how to to join multiple database tables using db_select in Drupal 7, let me tell you that we can add as many joins as we want and most methods such as, 'fields', 'conditions', joins etc. can be called multiple times. However, one thing may be worth mentioning is that the call to join() needs to be separate. It should not be "chained", meaning that one should use this,
In order to add a new theme template file (.tpl.php file), we need to implement hook_theme() in our Drupal 7 module. A theme template need to be specified in the hook_theme() function. They produce HTML and renders Drupal render array elements to the screen.
While using the D3 implementation in one of my project for collapsible tree, I used the following piece of codes to add dragging and zooming feature in the tree. At first I have downloaded the D3 JS and loaded to the page callback as specified in the D3 implementation notes.
We can create custom rules programmatically using the function hook_rules_action_info(). hook_rules_action_info() is a useful hook provided by rules API to create custom rules programmatically. We can use our custom functions to perform the actions that we require.
Following is a sample of the hook_rules_action_info implementation:
The Paragraphs module is a new way of content creation. Instead of putting all contents through WYSIWYG body field, including videos and images, end-users can now choose on-the-fly between pre-defined Paragraph Types independent from one another.
In Drupal 7, when we do customizations we would want the custom module to create content in the form of a render array. We know that a page callback should return a render array which allows the custom module to handle the content as long as possible in the page generation process. Sometimes, wrapping two render array elements together could be an easy way out while dealing with render array manipulations. Here is how we can achieve that.
Drupal offers a variety of ways to implement solutions when it comes to custom theming and it has been abused often due to the very same reason. Choosing the right way is what Drupal developers find tricky. If it is not done right, it is quite likely that you 'Awesome Drupal Website' would turn into a code-monster soon. This can even make maintenance difficult. Hope this 'tiny bit of' information could help you through it.
In Drupal 7, a theme function is a PHP function that is used to wrap the output variables with HTML. For adding a theme function in our custom Drupal 7 module, we need to implement hook_theme(). A theme function is prefixed with 'theme_'. However, they can't override existing theme functions. Such functions are invoked using theme() rather than being directly called. Also, they are faster compared to the template (.tpl) file implementations.
As the name suggests, a preprocess function is a precursor to a theme function. It runs first, irrespective of the fact that the theme function can also be implemented as a template (.tpl file) rather than a function. Preprocess functions can be implemented in both modules and themes. However, the preprocess implementations from modules run first, and those by themes run only last.
The drupal_write_record function is used to insert or update a record in the database based on the schema of the table. It helps in executing less database query. Let's take a look at the function given below.
View is the one of the popular Drupal module. Views are used to display a list of data, table of data etc. This article will guide you in recreating a view in Drupal 7. Its very easy to recreate a view.
Now all themes are in responsive manner. Bootstrap is the one of the best responsive theme. Its the good starter theme for Drupal 7. It has a lots of specific styles for every designs and we can create a subtheme from Bootstrap theme. It also become a good responsive theme.
Here I am listing some methods to clear Drupal caches. Drupal caching is done to improve and enhance overall performances of the site. Its always recommended to enable the page caching and block caching in Drupal.
Rules are very important and most common using thing in Drupal. We can create custom rules programmatically using the hook_rules_action_info. There is a useful hook hook_rules_action_info() provided by rules api to create custom rules programmatically. Using this We can use our custom functions to perform the actions that we require.
The drupal_static() function provides a temporary storage for data that should stick around even after execution. It also provides the central static variable storage. It preserves the data within a page request as well.