Drupal Coding Standards - do and don't

In each and every language there is a need of following coding standards. The Coding standard will differ based on each language. This article will demonstrate the coding standard we should following for Drupal Content Management System(CMS). This article compares coding standards for both Drupal 7 and Drupal 8 with some demos. Also, it will support the best approach to hack the Drupal Core and Contrib modules.

Drupal 7: Adding Drupal set messages using PHP(drupal_set_message()) and Javascript:

In Drupal messages are printed using the PHP function drupal_set_messages(). This article will discuss the adding message to page through the PHP as well as Javascript. The normally the set message will create a div HTML wrapper for display the messages. Using the classes of the set message we can display the Error/Status/Warning message to the end users.

Drupal: Show Erros on Developing or WSOD

In Drupal while developing it not showing the errors instead of it will be showing us a White screen. This screen is known as White Screen Of Death(WSOD). During development, we need to debug the errors, for this purpose we want to show errors. To show errors instead or white screen we need to add below lines in "settings.php".