Drupal Articles

Exposing custom Fields and Filters to Views using hook_views_data_alter()

This tutorial will show you how to add your own custom Fields and Filters to expose to Views.

Creating Custom Contextual Links in Drupal 7

How to add your own, custom context links to Drupal Views and Nodes using the Custom Context Links module.

Creating dynamic output for an entity in Drupal 7 using hook_entity_view()

If you need to create dynamic output on an entity when it is displayed on your Drupal site you have multiple options. One method that is easy to implement is using hook_entity_view()

How to redirect all traffic to HTTPS on your Drupal site

SinceGoogle announced that it gives an additional SEO boost for sites that are fully encrypted with HTTPS it is now advisable to encrypt your entire site and not just pages with sensitive information.

How to create a block that will display any sub-menu links to the page you are on

If you have nested menu links (sub-menus) in your Drupal menu system then sometime you may want to display any menu items that are children of the page you are currently on. This code will create a Drupal block that you can position within any of your theme's regions and it will automatically display an HTML list of sub-menu items.

How to change the output of the $submitted values of a node

By default, if you have a content type's "Display author and date information" turned on then Drupal will output something similar to the following when viewing a node: Submitted by John Smith on Sat, 11/15/2014 - 18:15. However, there may be times when you'll want to change the default output structure to, perhaps, display only the author or only the date. Or, you may want to change the display the format of the date output.

How to prevent Drupal from checking for updates on a contrib module

Sometime you may not want a contributed module that is installed in your Drupal site to be checked for updates. Perhaps you need to remain at a particular version for stability or compatibility reasons. Or, perhaps you've had to result to hacking the module to add your own custom code. Normally, Drupal will check all installed modules automatically, or manually, depending on your settings and, if an update is available, it will be listed on your Available Updates screen with access to quickly update the module automatically. This could be bad if you don't want your module to be updated.

Creating a basic Drupal 7 module

When looking to achieve something in Drupal you'll often find the best solution is to put some code into a custom module. This often sounds daunting if you're not very experienced in Drupal or PHP but it's actually very simple to create a basic module to hold your custom code. Although modules often contain many files, at its most basic level, a Drupal module only needs two files to function: