You are here

protected function BootstrapDropdown::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/BootstrapDropdown.php, line 29
Contains \Drupal\bootstrap\Plugin\Preprocess\BootstrapDropdown.

Class

BootstrapDropdown
Pre-processes variables for the "bootstrap_dropdown" theme hook.

Namespace

Drupal\bootstrap\Plugin\Preprocess

Code

protected function preprocessVariables(Variables $variables) {
  $this
    ->preprocessLinks($variables);
  $toggle = Element::create($variables->toggle);
  $toggle
    ->setProperty('split', $variables->split);

  // Convert the items into a proper item list.
  $variables->items = [
    '#theme' => 'item_list__dropdown',
    '#items' => $variables->items,
    '#context' => [
      'alignment' => $variables->alignment,
    ],
  ];

  // Ensure all attributes are proper objects.
  $this
    ->preprocessAttributes();
}