Html.php in Open Social 8.7
File
themes/socialbase/src/Plugin/Preprocess/Html.php
View source
<?php
namespace Drupal\socialbase\Plugin\Preprocess;
use Drupal\bootstrap\Plugin\Preprocess\PreprocessBase;
class Html extends PreprocessBase {
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
if ($variables['root_path'] == 'node') {
$current_path = \Drupal::service('path.current')
->getPath();
$path_pieces = explode("/", $current_path);
$path_target = [
'add',
'edit',
];
if (count(array_intersect($path_pieces, $path_target)) > 0) {
$variables['node_edit'] = TRUE;
}
}
$variables['svg_icons'] = file_get_contents(drupal_get_path('theme', 'socialbase') . '/assets/icons/icons.svg');
}
}
Classes
Name |
Description |
Html |
Pre-processes variables for the "html" theme hook. |