You are here

public function Input::preprocessElement in Express 8

Preprocess the variables array if an element is present.

Parameters

\Drupal\bootstrap\Utility\Element $element: The Element object.

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

Overrides PreprocessBase::preprocessElement

1 call to Input::preprocessElement()
InputButton::preprocessElement in themes/contrib/bootstrap/src/Plugin/Preprocess/InputButton.php
Preprocess the variables array if an element is present.
1 method overrides Input::preprocessElement()
InputButton::preprocessElement in themes/contrib/bootstrap/src/Plugin/Preprocess/InputButton.php
Preprocess the variables array if an element is present.

File

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

Class

Input
Pre-processes variables for the "input" theme hook.

Namespace

Drupal\bootstrap\Plugin\Preprocess

Code

public function preprocessElement(Element $element, Variables $variables) {

  // Autocomplete.
  if ($route = $element
    ->getProperty('autocomplete_route_name')) {
    $variables['autocomplete'] = TRUE;
  }

  // Create variables for #input_group and #input_group_button flags.
  $variables['input_group'] = $element
    ->getProperty('input_group') || $element
    ->getProperty('input_group_button');

  // Map the element properties.
  $variables
    ->map([
    'attributes' => 'attributes',
    'icon' => 'icon',
    'field_prefix' => 'prefix',
    'field_suffix' => 'suffix',
    'type' => 'type',
  ]);

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