Html.php in Open Social 8.8
Same filename in this branch
Same filename and directory in other branches
- 8.9 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.2 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.3 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.4 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.5 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.6 themes/socialblue/src/Plugin/Preprocess/Html.php
- 8.7 themes/socialblue/src/Plugin/Preprocess/Html.php
Namespace
Drupal\socialblue\Plugin\PreprocessFile
themes/socialblue/src/Plugin/Preprocess/Html.phpView source
<?php
namespace Drupal\socialblue\Plugin\Preprocess;
use Drupal\bootstrap\Utility\Variables;
use Drupal\socialbase\Plugin\Preprocess\Html as HtmlBase;
/**
* Pre-processes variables for the "html" theme hook.
*
* @ingroup plugins_preprocess
*
* @BootstrapPreprocess("html")
*/
class Html extends HtmlBase {
/**
* {@inheritdoc}
*/
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
$variables['colors'] = [];
foreach (color_get_palette($variables['theme']['name']) as $key => $value) {
$key = str_replace('-', '_', $key);
$variables['colors'][$key] = $value;
}
}
/**
* {@inheritdoc}
*/
public function preprocessVariables(Variables $variables) {
// Add style class to html body.
$style = theme_get_setting('style');
if (!empty($style)) {
$variables['attributes']['class'][] = 'socialblue--' . $style;
$route_match = \Drupal::routeMatch();
// For SKY when we are on edit user or edit profile
// we want to distinct the root_path with a better class name
// this is used in html.html.twig.
if ($route_match
->getParameter('user') && $route_match
->getRouteName() === 'profile.user_page.single' || $route_match
->getRouteName() === 'entity.user.edit_form') {
$variables['root_path'] = 'user-edit';
}
}
parent::preprocessVariables($variables);
}
}