Welcome to the Drupal8 info and tracking site by Webel IT Australia

This site progressively records aspects of Drupal8 that may be of use to other Drupal CMS and PHP developers. It is not, and will never be, a complete guide to Drupal8. It is offered in the hope that it may be of some use to others.

This site also promotes progress towards full object-orientation in Drupal and the use of graphical Unified Modeling Language (UML) software engineering support. It also employs UML (and the systems engineering dialect SysML) for analysis of the documentation and code of Drupal8 !

HOWTO detect whether an entity reference field is a taxonomy term reference and flag it for targeting in field.html.twig and your CSS

Submitted by webel on 2016-04-23;   Last modified 2016-04-25;

Now that the Taxonomy term reference field has been removed in favor of Entity reference it begs the question how one is supposed to specifically target taxonomy term reference fields in Twig templates and in your CSS.

The following (which currently involves checking for the existence of a particular method) may not be very pretty, but it works.

In your THEME.theme:

That @#%^& hook_theme() is still alive in Drupal8. Dr Darren deciphers the docs !

Submitted by webel on 2016-04-22;   Last modified 2016-04-25;
The meaning of the keys, structures, and return values of hook_theme(), according to the documentation, changes from cats to dogs on Wednesdays (but only the first Wednesday in the month) except when the moon is full, unless you have blue eyes, but not when fresh bread is baking or during rocket launches (unless the rocket fails) - but there is a provision for it returning a horse if parachutes are used, or if you stand on your head.

[pattern] Don't Repeat Yourself (DRY Principle)

Submitted by webel on 2016-04-21;   Last modified 2016-04-21;

In software engineering, don't repeat yourself (DRY) is a principle of software development aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures. The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." ..

When the DRY principle is applied successfully, a modification of any single element of a system does not require a change in other logically unrelated elements. Additionally, elements that are logically related all change predictably and uniformly, and are thus kept in sync.

Drupal code (and note I don't blame PHP here), both core and contributed, breaks the DRY principle so often, so constantly, so annoyingly repetitively, that it actually makes me (otherwise used to nicely coded object-oriented Java or C++ with model-driven support through graphical UML) feel like this:

This web site and Webel's OOE = Object Oriented Examples = One Of Each module were in part created to discourage further repetition of .. well nearly everything that is repeated in Drupal code, like those strings used as keys of structured arrays that have no intelligence other than documented key conventions (spread all over the place because there are no getters/setters to document), instead of intelligent objects.

TIP: making the node content type available to Twig templates

Submitted by webel on 2016-04-09;   Last modified 2016-04-18;

You may have noticed that on some pages on this site, the type of a node page (both in page displays and teaser displays) appears in the title in brackets like this:

[module] Admin Toolbar

In this example, we demonstrate how this is achieved using Drupal8 theming preprocessor functions to create a convenient type variable available to selected Twig templates.