Blogs on

preprocess

knackforge blog

Setting browser tab/ window title from Drupal menu

One of the Drupal sites we did recently had a requirement to set browser tab (or window) title from Drupal menu. Usually it will be h1 title of the web page in Drupal that will be shown as tab title. Even the modules like page_title module doesn't seem to have any configuration for our case. But there is always some APIs and hooks to rescue the developer. For our case, the following eight line snippet did the trick,

Continue reading →
knackforge blog

Altering views table output

Views module provides an easy way to render data from the Drupal database. It is often needed to use table output format to meet the design requirements. One such similar occasion needed customizing the table output.

The scenario was, we had a list of discounts with validity date as its one of the attributes. We wanted to show expired discounts in a different color to distinguish it from active discounts. What helped us was hook_preprocess_views_view_table().

Continue reading →