Themer-friendly menu link CSS classes for Drupal theme
What this code does is to give themers an easier way to style individual menu items in Drupal. For example, if you have a menu item title "Company Profile" and you want this link to be red colour, the...
View ArticleDisplay Drupal menu local task tab according to node content type
By default every node should have the menu tab (MENU LOCAL TASK) of View and Edit.If your module wants to add its own tab but only restricted to content type of "foo", then use the following code...
View ArticleEmbed Drupal node form anywhere
Simple 1 line of code to embed a Drupal node form anywhere in your site although I would recommend doing it the Drupal way which is creating a custom module for this.print...
View ArticleProgrammatically show number of items in Drupal Commerce shopping cart
This is a short code snippet to programmatically show number of items in your Drupal Commerce shopping cart block.You can use this code anywhere, be it in your custom module or theme.<?phpglobal...
View ArticleHandy Drupal Module to show list of enabled modules
What does this module do? Quite simply, it will show list of enabled Drupal modules (that are placed in sites/all/modules directory) in a table format.When do you need to use this? In my use case, my...
View ArticleQuick Jump - Simple Drupal module for quick navigation to any content or...
Recently, I came across a need for quick navigation and access to any page in Drupal website with the least amount of clicks possible. Inspired by Quicksilver app for Mac, this Drupal module was...
View ArticleEmbed Drupal block region into node page
Snippet to insert or embed Drupal block region into a node template.First of all, define the block region in your theme's .info file.YOUR_THEME.info...regions[BLOCK_REGION_NAME] = Block region...
View ArticleAdd Open Graph Protocol meta data to your Drupal node page
Here's yet another handy and non-modular snippet to quickly add Open Graph meta datas to your <head> tag.A little description about Open Graph (taken from The Open Graph protocol website):Tags:...
View ArticleSimple example of how to use Drupal to serve file downloads
Ever been in a situation whereby you want to serve file download via Drupal? Such as exporting nodes to CSV, etc. Well this tutorial is for you.Disclaimer: This may not be the best way. Please do...
View ArticleExtend Drupal's default Taxonomy terms overview table listing
Sharing something I recently needed to do.I wanted to add a new column to the default Drupal's Taxonomy term listing page that provides a link to a DraggableViews (receives term ID from contextual...
View ArticleDrupal add timestamp to Taxonomy term data
I had another request to alter the default taxonomy_term_data table and adding the timestamps; created and changed just like in the node database table.Here's a little snippet that will do the...
View ArticleAdd custom Contextual Links to Drupal node teaser pages
I recently wanted to have a quicker way to unpublish my nodes in one of my Drupal project with Contextual Links.This mini code snippet will show you how to create a custom module to add links to the...
View ArticleCreate your own custom Drupal block programmatically
Super duper simple example on how to programmatically create your own custom Drupal blocks and display any content.Code snippet below needs to be in a custom module./** * Implements hook_block_info()....
View ArticleReindex Drupal's Search API module indexes programmatically
I had recently found the need to manually reindex the Search API indexes programmatically after performing some other operation. The code snippet below will do just that for you :)Tags: drupaldrupal...
View ArticleIntegrate your custom Drupal forms with Mollom CAPTCHA spam protection
ReCAPTCHA allows your to add spam protection to your custom Drupal forms without any further coding work.However, if you want to integrate with Mollom's CAPTCHA protection, the following code snippet...
View ArticleRemove the "No front page content has been created yet." in the default...
/** * Implements template_preprocess_page(). */function YOUR_THEME_preprocess_page(&$vars) { // Remove the "No front page content has been created yet.". if...
View ArticleEasily hide Drupal fieldset group from forms
First, hook into your existing form, find your Form ID./** * Implements hook_form_FORM_ID_alter(). */function YOUR_MODULE_form_FORM_ID_alter(&$form, &$form_state) { $form['#after_build'][] =...
View ArticlePrint or render Drupal user account profile form anywhere
Code below allows you to render the Drupal user edit form anywhere. Replace UID with the user account ID to edit.$account = user_load(UID);module_load_include('inc', 'user', 'user.pages');$form_state =...
View ArticleKeywordTool.io - 750 Google Keyword Suggestions for Free. Use 194 Google...
KeywordTool.io is the best free alternative to Google Keyword Planner and Ubersuggest. It uses Google's autocomplete feature to get over 750 long-tail keywords for any given query. KeywordTool.io...
View Article