Yogesh Chauhan's Blog

The Drupal flow

in Drupal on July 10, 2020

If you want to go deeper with Drupal, you should understand how information flows between the system's layers.

There are five main layers to consider:

1. Nodes

At the base of the system is the collection of nodes—the data pool. Before anything can be displayed on the site, it must be an input as data.

2. Modules

The next layer up is where modules live.

Modules are functional plugins that are either part of the Drupal core (they ship with Drupal) or they are contributed items that have been created by members of the Drupal community.

Modules build on Drupal's core functionality, allowing you to customize the data items (fields) on your node types; set up e-commerce; programmatically sorting and display of content (custom output controlled by filters you define); and more.

There are thousands of different options within the fast-growing repository of contributed Drupal modules. They represent the innovation and collaborative effort of everyone from individuals to large corporations.

3. Blocks and Menus

Blocks often provide the output from a module or can be created to display whatever you want, and then can be placed in various spots (Regions) in your template (theme) layout.

📌 Blocks can be configured to output in various ways, as well as only showing on certain defined pages, or only for certain defined users.

Menus are navigators in Drupal, which define the content coming on each defined menu path (relative URL). Menus are a core element of Drupal which provide links to all the pages created in Drupal.

4. User Permissions 

Next are user permissions. Permissions determine what users are allowed to do and see. Permissions are assigned (or not) to various "roles", which are in turn given to users.  

5. Theme

On the top layer is the site theme (the "skin"). This is made up predominantly of XHTML and CSS, with some PHP variables intermixed, so Drupal-generated content can go in the appropriate spots.

Also included with each theme is a set of functions that can be used to override standard functions in the modules in order to provide complete control over how the modules generate their markup at output time.

Templates can also be assigned on-the-fly based on user permissions.

This directional flow from bottom to top controls how Drupal works. Is some new functionality you want not showing up? Perhaps you uploaded the module into the system but have not activated it yet, and this is making everything downstream non-functional.

Maybe the module is installed and activated, but you still don’t see what you want on your site. Did you forget to place the block? Or are your user permission settings conflicting with what you want and your users are not set to see the output?

Additionally—as mentioned earlier—getting the kind of granular control you want over the details of the XHTML module outputs requires understanding this flow.

Are you using a module that does exactly what you want, only you wish the markup was just a little bit different?

Maybe you’d like it to use different tags, or you’d like to assign a CSS class to something?

You accomplish this by copying the output function from the module and pushing it up to the functions document in your theme. Modify the code there, and when the system goes to output, it will see your customized function and use that instead.

Credit: Drupal

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
How to draw an SVG path on scroll using JavaScript?JavaScriptList of all Pseudo Elements in CSSCSSHow to display modal from bottom to top using CSS and JavaScript?CSSHow to create ‘share on LinkedIn’ link using just HTML?HTMLHow to Draw a Text Image using JavaScript?JavaScriptRBV Framework and closing of big brandsMiscellaneous