function UserThemeHooks::preprocessBlock

Implements hook_preprocess_HOOK() for block templates.

Attributes

#[Hook('preprocess_block')]

File

core/modules/user/src/Hook/UserThemeHooks.php, line 15

Class

UserThemeHooks
Hook implementations for user.

Namespace

Drupal\user\Hook

Code

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

    }
  }
}

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