function protected function BootstrapDropdown::preprocessVariables

8.x-3.x BootstrapDropdown.php protected BootstrapDropdown::preprocessVariables(Variables $variables)

Preprocess the variables array.

Parameters

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

Overrides PreprocessBase::preprocessVariables

Class

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

Namespace

Drupal\bootstrap\Plugin\Preprocess

Source src/Plugin/Preprocess/BootstrapDropdown.php (line 25)

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();
}