Top menu

Add join with custom database table in hook_views_query_alter()

In this example i would add a join to the database table “node” with an other database table “event_submissions” which i created in my custom module, so i will add a hook_views_query_alter() function in mymodule.module file :

This code allows me to get the events that the current user had participated.

0

Alter captcha field with the hook_element_info_alter()

If you want to change the field properties of  the Captcha module or the Image CAPTCHA module you will see that this is not possible with hook_form_alter () because through this function we can not access to the fields of the captcha, the picture below shows an example of what you get when we display the variable $form in […]

0

Remove additional_settings from node add/edit form

When printing a form in Drupal, it has the right to display an area to define more advanced settings. This useful area when a director and totally useless for visitors (see dangerous): There are certainly several ways to remedy this problem, but I suggest you mine which seems clean, just change the forms no longer […]

0

How to get the URL for an image style derivative

To get the URL of an image after applying a particular style on the original picture, it is very simple just use the function below :

Here is an example to use this function :

So we get in the variable $ picture_path the url of the image on which we apply the […]

0

How to insert a block into a node or template in Drupal 7

   

$block = module_invoke(‘simplenews’, ‘block_view’, ’24’);

0

How do I redirect a form after has been submitted

   

OR :

       

0

Get drupal installed document root

To get the complete base path where the Drupal site is installed you can use:

On a Ubuntu system you will get something like:

If you only use “base_path()”, you will obtain only:

0

Add attribute to field form

 

 

0

Remove the “grippie” div from textarea

To delete the following div which appears below your texterea

You should add the code below in the form_alter hook

0

How to display image using a specific image style

Below is an example of how to use the “theme_image_style ($ variables)” function to get the HTML code of an image on which a specific style is applied:

This gives us the following result:

       

0