By junaid on Thu, 03/12/2015 - 13:58

This article will guide you to change the style of a single field in a specific content type. Here I am going guide how to style 'Tags' field of 'article' content type. Standard Drupal 8 distribution comes with 'Article' content type, and it is having 'Tags' field. So, you can try out this on a standard Drupal 8 installation.

By junaid on Thu, 01/29/2015 - 14:00

While programming for Drupal, it is a very common scenario to get the language code for a given entity. A bad practice being followed by many programmers is hard-coding the value 'und' directly as language code. Some programmers will take 'language' property of the entity object, this only works for entity of type node and entities that have property named 'language' as entity key for language.

By junaid on Fri, 11/07/2014 - 14:16

When you implement hook_theme() in Drupal, there is provision to specify the file which should be loaded for the theme functions and preprocess functions to be found. So, we can simplify module file by moving out theme function and preprocess function of our theme entries to separate file. This also has added benefit of reducing module loading. On each bootstrapping Drupal will load every .module file those are of enabled modules. So we should consider moving out code from .module file and also giving modular structure.

By junaid on Mon, 04/07/2014 - 00:39

While working on Drupal, we may need to get taxonomy term name from its id. In Drupal 7, the easiest way would be to call taxonomy_term_load().

taxonomy_term_load() will return taxonomy term object containing all term properties.

Sometimes, we may need more efficient method of getting term name without the heaviness of other properties of that term. And there is no such function in Drupal 7.

Subscribe to