How to create custom tokens in Drupal 7

One of the great feature in drupal is tokens system. Tokens are reusable text that can be placed into documents via simple placeholders, like %site-name or [user]. In Drupal there are many default tokens are made available thru’ token module e.g. nodes, users, taxonomy as well as other site related tokens. For example to display site name we have [site:name] token, to display node author we have [node:author]. All these tokens are properties of entities. And if we add new field in node then these field will be available as token. For example [node:body] is the token where it will display body field.

Implementing themes based on specific conditions in Drupal 7

In drupal 7 we have options to set default theme & admin theme. There are limitations, Admin theme will be available for roles which has access permission for admin theme. But in case if we have conditions to set specific theme for specific page based on user roles or specifying theme for particular node types, drupal core will not provide options to do these. We do have module available for this purpose - ThemeKey. But we can achieve by using drupal hooks also. In this post I am going to explain how we can change particular theme for different pages based on various conditions.

Writing custom Drush commands in Drupal 7

As a drupal developer we use drush on daily basis. For example clearing the cache, downloading or enabling modules/themes, updating modules. All these commands comes with core but drupal also provides hooks to integrate with our custom modules. Today we are discussing about how we can write drush commands through our custom module. We are taking example - “Count of nodes by type”

How to get dynamic or Custom page titles in Drupal 7

Recently I was working in a project where we needed to show page title in format of [ node count associated with taxonomy term] [taxonomy term page is associated with] | [site name]. By default drupal 7 provides page title “term name | site name” for term pages. Our requirement was to get page title 125 vegetable recipe blog | my site name. Here 125 is node count of vegetable recipe tag. This is how we have  achieved this using  hook_preprocess_html().


About Us

Valuebound is a Drupal services company offering expert consulting, development, training and support. As regular contributors to the Drupal community, we can guarantee your project will meet the high standards stipulated by our community.

Request a Quote
Call Us: +91 (808) 804-8711

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.