function ThemeRegionTestThemeHooks::preprocessRegion

Implements hook_preprocess_HOOK() for region templates.

Attributes

#[Hook('preprocess_region')]

File

core/modules/system/tests/modules/theme_region_test/src/Hook/ThemeRegionTestThemeHooks.php, line 17

Class

ThemeRegionTestThemeHooks
Hook implementations for theme_region_test.

Namespace

Drupal\theme_region_test\Hook

Code

public function preprocessRegion(&$variables) : void {
  if ($variables['region'] == 'sidebar_first') {
    $variables['attributes']['class'][] = 'new_class';
  }
}

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