function system_preprocess_block

Implements hook_preprocess_HOOK() for block.html.twig.

File

drupal/core/modules/system/system.module, line 2612
Configuration system that lets administrators modify the workings of the site.

Code

function system_preprocess_block(&$variables) {

  // Derive the base plugin ID.
  list($plugin_id) = explode(':', $variables['plugin_id'] . ':');
  switch ($plugin_id) {
    case 'system_powered_by_block':
      $variables['attributes']['role'] = 'complementary';
      break;
    case 'system_help_block':
      $variables['attributes']['role'] = 'complementary';
      break;
    case 'system_menu_block':
      $variables['attributes']['role'] = 'navigation';
      $variables['attributes']['class'][] = 'block-menu';
  }
}