You are here

public function Html::preprocess in Open Social 8.8

Same name in this branch
  1. 8.8 themes/socialblue/src/Plugin/Preprocess/Html.php \Drupal\socialblue\Plugin\Preprocess\Html::preprocess()
  2. 8.8 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
Same name and namespace in other branches
  1. 8.9 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  2. 8 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  3. 8.2 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  4. 8.3 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  5. 8.4 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  6. 8.5 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  7. 8.6 themes/socialbase/src/Plugin/Preprocess/Html.php \Drupal\socialbase\Plugin\Preprocess\Html::preprocess()
  8. 8.7 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\Preprocess

Code

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',
      'edit',
    ];
    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');
}