Drupal

Get a file's URI in Drupal 8

Get a file's URI in Drupal 8

Get information on the current request

Drupal8. The Request object can be obtained by calling the request method on \Drupal

Getting a node's field value

Drupal 8. Getting a node's field value

Get a term's parent TID

Provided we have the TID of the child term, the parent is found by:

Programmatically creating a custom block

Drupal 8. Provided our module is called customblock add the file CustomblockBlock.php to src/Plugin/Block. Inside it put something along the lines of:

Loop through mulitiple field items in Twig

This iterates through the field items but not the field meta data.

Add class name to body class

In the case below we add the is-node as well as the node ID to the body class.

Overriding a service in Drupal 8

Suppose we want to override the maintenance_mode service. This service is responsible for granting and denying permission to users while the website is in maintenance mode. 

Pagina's

Subscribe to RSS - Drupal