4 * Contains \Drupal\bootstrap\Plugin\Preprocess\Input.
7 namespace Drupal\bootstrap\Plugin\Preprocess;
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\bootstrap\Utility\Variables;
14 * Pre-processes variables for the "input" theme hook.
16 * @ingroup plugins_preprocess
18 * @BootstrapPreprocess("input")
20 class Input extends PreprocessBase implements PreprocessInterface {
25 public function preprocessElement(Element $element, Variables $variables) {
27 if ($route = $element->getProperty('autocomplete_route_name')) {
28 $variables['autocomplete'] = TRUE;
31 // Create variables for #input_group and #input_group_button flags.
32 $variables['input_group'] = $element->getProperty('input_group') || $element->getProperty('input_group_button');
34 // Map the element properties.
36 'attributes' => 'attributes',
38 'field_prefix' => 'prefix',
39 'field_suffix' => 'suffix',
43 // Ensure attributes are proper objects.
44 $this->preprocessAttributes();