Twig reference

Referenced Entity - Twitter card

The key here is to use a special token, entity, which will allow us to chain the entities referenced one to the other from our token and to traverse them as for a small Sunday ballad. And because a drawing is better than a long speech, let us take a few examples.

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.

Print twig without markup

{{ content.field_name.0 }}


Drupal 8 bulk action

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'];

Reset Drupal 7 superadmin


Subscribe to Front page feed