function Stable9Hooks::preprocessViewsView
Same name and namespace in other branches
- main core/themes/stable9/src/Hook/Stable9Hooks.php \Drupal\stable9\Hook\Stable9Hooks::preprocessViewsView()
Implements hook_preprocess_views_view().
Adds BC classes that were previously added by the Views module.
Attributes
#[Hook('preprocess_views_view')]
File
-
core/
themes/ stable9/ src/ Hook/ Stable9Hooks.php, line 33
Class
- Stable9Hooks
- Hook implementations for stable9.
Namespace
Drupal\stable9\HookCode
public function preprocessViewsView(&$variables) : void {
if (!empty($variables['attributes']['class'])) {
$bc_classes = preg_replace('/[^a-zA-Z0-9- ]/', '-', $variables['attributes']['class']);
$variables['attributes']['class'] = array_merge($variables['attributes']['class'], $bc_classes);
}
if (!empty($variables['css_class'])) {
$existing_classes = explode(' ', $variables['css_class']);
$bc_classes = preg_replace('/[^a-zA-Z0-9- ]/', '-', $existing_classes);
$variables['css_class'] = implode(' ', array_merge($existing_classes, $bc_classes));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.