public function Html::preprocess in Open Social 8
Same name in this branch
- 8 themes/socialblue/src/Plugin/Preprocess/Html.php \Drupal\socialblue\Plugin\Preprocess\Html::preprocess()
- 8 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
Same name and namespace in other branches
- 8.9 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.2 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.3 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.4 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.5 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.6 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.7 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
- 8.8 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::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 PreprocessBase::preprocess
1 call to Html::preprocess()
- Html::preprocess in themes/
socialblue/ src/ Plugin/ Preprocess/ Html.php - Preprocess theme hook variables.
1 method overrides Html::preprocess()
- Html::preprocess in themes/
socialblue/ src/ Plugin/ Preprocess/ Html.php - Preprocess theme hook variables.
File
- themes/
socialbase/ src/ Plugin/ Preprocess/ Html.php, line 19
Class
- Html
- Pre-processes variables for the "html" theme hook.
Namespace
Drupal\socialbase\Plugin\PreprocessCode
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// Identify the difference between nodes and node/add & node/edit.
if ($variables['root_path'] == 'node') {
$current_path = \Drupal::service('path.current')
->getPath();
$path_pieces = explode("/", $current_path);
$path_target = [
'add',
];
if (count(array_intersect($path_pieces, $path_target)) > 0) {
$variables['node_edit'] = TRUE;
}
}
// Get all SVG Icons.
$variables['svg_icons'] = file_get_contents(drupal_get_path('theme', 'socialbase') . '/assets/icons/icons.svg');
}