public function Page::preprocess in Open Social 8.9
Same name in this branch
- 8.9 themes/socialblue/src/Plugin/Preprocess/Page.php \Drupal\socialblue\Plugin\Preprocess\Page::preprocess()
- 8.9 themes/socialbase/src/Plugin/Preprocess/Page.php \Drupal\socialbase\Plugin\Preprocess\Page::preprocess()
Same name and namespace in other branches
- 8.8 themes/socialblue/src/Plugin/Preprocess/Page.php \Drupal\socialblue\Plugin\Preprocess\Page::preprocess()
Preprocess theme hook variables.
Parameters
array $variables: The variables array, passed by reference (modify in place).
string $hook: The name of the theme hook.
array $info: The theme hook info array.
Overrides Page::preprocess
File
- themes/
socialblue/ src/ Plugin/ Preprocess/ Page.php, line 19
Class
- Page
- Pre-processes variables for the "page" theme hook.
Namespace
Drupal\socialblue\Plugin\PreprocessCode
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
if (theme_get_setting('style') === 'sky') {
// Display merged sidebar on the left side of profile pages, except edit.
$route_match = \Drupal::routeMatch();
if ($route_match
->getParameter('user') && $route_match
->getRouteName() !== 'profile.user_page.single' && $route_match
->getRouteName() !== 'entity.user.edit_form') {
$variables['content_attributes']
->addClass('sidebar-left', 'content-merged--sky');
}
// Display merged sidebar on the left side of group pages, except edit.
if ($route_match
->getParameter('group') && $route_match
->getRouteName() !== 'entity.group.edit_form') {
$variables['content_attributes']
->addClass('sidebar-left', 'content-merged--sky');
}
// Add extra class if we have blocks in both complementary regions.
if ($variables['page']['complementary_top'] && $variables['page']['complementary_bottom']) {
$variables['content_attributes']
->addClass('complementary-both');
}
}
}