Creating a custom service

A simple Drupal 8 example service converting a string to uppercase.

Customizing a user object

// Load the currently logged in user $user = \Drupal\user\Entity\User::...

Get the UID of the currently logged in user

\Drupal::currentUser() leverages the AccountProxy class, which is "a proxied implementation of AccountInterface". This means..

Making content themeable in Drupal 8

hook_theme() is still there and its implementation hasn't really changed since Drupal 7.

Loading entities

// Use the static method $node = Node::load(1); // Dynamic entity type, entity_load() now loads

drupal_goto() replacements in Drupal 8

drupal_goto() has been removed in Drupal 8. To apply a internal or external redirect there are several options.

Creating a node programmatically

There are 3 methods of creating a node (or with some slight adjustments any content entity) in Drupal 8:

Sass output formaten

Sass kent 4 verschillende output formaten, met de (niet persé Intuïtieve) namen: expanded nested compact compressed Als dit onze oorspronkelijke SCSS code is:

Pages

Subscribe to marceldoorn.nl RSS