You are here

public function Links::preprocessVariables in Express 8

Preprocess the variables array.

Parameters

\Drupal\bootstrap\Utility\Variables $variables: The Variables object.

Overrides PreprocessBase::preprocessVariables

File

themes/contrib/bootstrap/src/Plugin/Preprocess/Links.php, line 25
Contains \Drupal\bootstrap\Plugin\Preprocess\Links.

Class

Links
Pre-processes variables for the "links" theme hook.

Namespace

Drupal\bootstrap\Plugin\Preprocess

Code

public function preprocessVariables(Variables $variables) {
  if ($variables->theme_hook_original === 'links' && $variables
    ->hasClass('operations')) {
    $variables
      ->addClass('list-inline');
    foreach ($variables->links as &$data) {
      $link = Element::create($data['link']);
      $link
        ->addClass([
        'btn',
        'btn-sm',
      ]);
      $link
        ->colorize();
      $link
        ->setIcon();
      if ($this->theme
        ->getSetting('tooltip_enabled')) {
        $link
          ->setAttribute('data-toggle', 'tooltip');
        $link
          ->setAttribute('data-placement', 'bottom');
      }
    }
  }
  $this
    ->preprocessAttributes();
}