Z90 focus

When you want to track a slow-moving
subject but other subjects or people appear
in the foreground.


Portier is an email-based, passwordless authentication service
that you can (but don't have to) host yourself.


You don’t know what you’re missing
without session replay.
FullStory records and reproduces real user experiences on your site helping you support customers, boost conversions, and debug faster.


Why bother with doing a database. You can write a JavaScript function that you run and receive a response from by hitting a URL

The provided host name is not valid for this server.

This error message is coming a feature that was added to Drupal 8 to protect against HTTP Host header attacks. The feature is also described in the change record that was generated for the patch.

Essentially, is was possible to spoof the HTTP Host header for nefarious purposes, and trick Drupal into using a different domain name in several subsystems (particularly link generation). In other words, the HTTP Host header needs to be considered user input, and not trusted.

Twig reference


{% (this is a block) %}
${ (this is an expression) }
${ this_is_also_a_variable }
${ variable | this_is_a_filter("and", "these are", arguments) }
this == is + an ~ "expression"
{# this is a comment, and is removed when the template is built #}

Block Twig

down vote

In a block twig you can access a field value like this:

{{ content['#block_content'].field_myfield.value }}

This is the database value of the field.

Most times you want to render a field:

{{ content.field_myfield }}

This will display the field as it is configured in the view mode.

Views D8 suggestions

Describes various views templates & overriding options.

All views templates can be overridden with a variety of names, using the view, the display ID of the view, the display type of the view, or some combination thereof.

For each view, there will be a minimum of two templates used. The first is used for all views: views-view.html.twig.

Taxonomy term view mode suggestion

You need to use underscores in your suggestion (but continue to use dashes in your template file name):

function linkup_theme_suggestions_taxonomy_term_alter(&$suggestions, $vars, $hook) {
if($vars['elements']['#view_mode'] == 'teaser') {
$suggestions[] = 'taxonomy_term__teaser'; // note underscores
you could also leave out your condition and do:

function linkup_theme_suggestions_taxonomy_term_alter(&$suggestions, $vars, $hook) {
$suggestions[] = 'taxonomy_term__' . $vars['elements']['#view_mode'];

Twig |length filter

New in version 2.3: Support for the __toString() magic method has been added in Twig 2.3.

The length filter returns the number of items of a sequence or mapping, or the length of a string.

For objects that implement the Countable interface, length will use the return value of the count() method.

For objects that implement the __toString() magic method (and not Countable), it will return the length of the string provided by that method.

{% if users|length > 10 %}
{% endif %}

Tiny gap under video HTML 5

It's because they are inline elements with resizable height (most inline elements are not explicitly resizable). If you set them to display: block; the gap goes away. You can also set vertical-align: top; to achieve the same result.

D8 How do I add a node ID as class to the <body> tag?

down vote
In mytheme.theme file: add the below code.

function mytheme_preprocess_html(&$variables) {
// Add node id to the body class.
$node = \Drupal::routeMatch()->getParameter('node');
if($node) {
$variables['attributes']['class'][] = 'node-' . $node->id();
This will add "node-{{nid}}" class in body tag.

The Simplest Way To Center Elements Vertically And Horizontally


The idea, of course, revolves around flexbox. First, we create a container in which we want everything to be centered:

You can place this container div anywhere you want. In the live example above we've made it take up the whole width and height of the page.

As we said earlier, we will be using only three lines of code. Here they are:

display: flex;
justify-content: center;
align-items: center;

Theme suggestion for D8 blocks

* Implements hook_theme_suggestions_HOOK_alter() for form templates.
* @param array $suggestions
* @param array $variables
function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
// Block suggestions for custom block bundles.
if (isset($variables['elements']['content']['#block_content'])) {
array_splice($suggestions, 1, 0, 'block__bundle__' . $variables['elements']['content']['#block_content']->bundle());

Node type twig

You should be able to get the human-readable name of the content type (or the "label") by doing {{ node.type.entity.label }} in your node Twig template.