Blogz

Recent Blogz

Drupal 8: Enabling/Disabling Theme Debugging

Theme debugging will help on developing our Drupal 8 site. It will suggest the TWIG file that associate for DOM structure to change. This information is appended to command in HTML that Drupal renders. We can access this information in inspecting the HTML or on developer window. When debugging is enabled the markup of each Twig template is surrounded by HTML comments that, contain theming information, such as template file name suggestions.

Drupal 7 user_access() : Field level permission for create, edit, delete values

In Drupal we can specify the user role wise permission for access specific fields value create, edit and delete. This can be achieved by calling the fuction "user_access()" from user core module. This function accepts permission string and user object to check. The function return boolean value TRUE is user has permission else FALSE. Below is the syntax and sample code to use user_access() function.

Drupal Inline Entity Form Module hook_form_alter()

The Inline entity form is the Drupal Contribute module. Which help to embed a entity form into another entity. Example: Commerce product add form cam be used in Node form. This module will help to create, update and delete entity based on its parent entity. This module embed entity form as the object to its parent form. To alter this specific entity form there is hook called hook_inline_entity_form_entity_form_alter(). Below is the syntax and example to usage of hook_inline_entity_form_entity_form_alter() to alter inline forms.

Drupal 8 : Programatically Enabling/Disabling Javascript Local storage for Drupal 8 Forms

Using the help of JavaScript we can able to store the values at browser(local storage). In Drupal 8 core "form.js" file help to maintain form local storage. This can be achieved by sitting boolean value to form key 'data-user-info-from-browser'. The below sample code show how to form variable to save in local storage.