function NodeThemeHooks::preprocessBlock

Implements hook_preprocess_HOOK() for block templates.

Attributes

#[Hook('preprocess_block')]

File

core/modules/node/src/Hook/NodeThemeHooks.php, line 249

Class

NodeThemeHooks
Hook implementations for the node module.

Namespace

Drupal\node\Hook

Code

public function preprocessBlock(&$variables) : void {
  if ($variables['configuration']['provider'] == 'node') {
    switch ($variables['elements']['#plugin_id']) {
      case 'node_syndicate_block':
        $variables['attributes']['role'] = 'complementary';
        break;

    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.