Drupal 7

[Drupal] How to wrap two render array elements together?

August 25, 2015 - 16:51

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.

Theme function VS template file in Drupal 7

August 25, 2015 - 15:50

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' could help you through it.

How to add a theme function in your custom Drupal 7 module?

August 24, 2015 - 18:16

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.

[Drupal] How to implement hook_preprocess_HOOK() function in your custom module?

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.

[Drupal] How can we assign different groups for a user and retrieve using Organic Group in Drupal 7?

August 10, 2015 - 17:48

In one of my Drupal project, we had a requirement to set a 2 level arrangement for users group. That means, we want to add more than one group for a user, in one of our Drupal site. Our experts find a solution for this by implementing Organic Group with user's account by some custom codes. Do you have a requirement like this? Connect with us.

[Drupal] How to popup a webform on menu click?

August 06, 2015 - 16:07

In one of my project, I have a requirement to show the form elements as a popup window on clicking a menu link. I have created the form using the Drupal webforms. I want to make this webform available as a popup window on click of the corresponding link. Drupal popup module helps to meet this requirement.

[Drupal] How to display and submit webform using ajax popup in Drupal 7?

August 04, 2015 - 18:24

In my project I have a requirement to display the error message of webform submissions in a popup window. Webform is a module for creating simple or multi-step forms in Drupal, in an easy way. To display the webform in popup is very hard to me. Webform Ajax module helps to meet this requirement. Its is very useful module for single or multi-step forms with pagination's in a popup box.