3 namespace Drupal\bootstrap\Plugin\Preprocess;
5 use Drupal\bootstrap\Utility\Element;
6 use Drupal\bootstrap\Utility\Variables;
9 * Pre-processes variables for the "input" theme hook.
11 * @ingroup plugins_preprocess
13 * @BootstrapPreprocess("input")
15 class Input extends PreprocessBase implements PreprocessInterface {
20 public function preprocessElement(Element $element, Variables $variables) {
22 if ($route = $element->getProperty('autocomplete_route_name')) {
23 $variables['autocomplete'] = TRUE;
26 // Create variables for #input_group and #input_group_button flags.
27 $variables['input_group'] = $element->getProperty('input_group') || $element->getProperty('input_group_button');
29 // Map the element properties.
31 'attributes' => 'attributes',
33 'field_prefix' => 'prefix',
34 'field_suffix' => 'suffix',
38 // Ensure attributes are proper objects.
39 $this->preprocessAttributes();