Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Preprocess / Input.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Preprocess;
4
5 use Drupal\bootstrap\Utility\Element;
6 use Drupal\bootstrap\Utility\Variables;
7
8 /**
9  * Pre-processes variables for the "input" theme hook.
10  *
11  * @ingroup plugins_preprocess
12  *
13  * @BootstrapPreprocess("input")
14  */
15 class Input extends PreprocessBase implements PreprocessInterface {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function preprocessElement(Element $element, Variables $variables) {
21     // Autocomplete.
22     if ($route = $element->getProperty('autocomplete_route_name')) {
23       $variables['autocomplete'] = TRUE;
24     }
25
26     // Create variables for #input_group and #input_group_button flags.
27     $variables['input_group'] = $element->getProperty('input_group') || $element->getProperty('input_group_button');
28
29     // Map the element properties.
30     $variables->map([
31       'attributes' => 'attributes',
32       'icon' => 'icon',
33       'field_prefix' => 'prefix',
34       'field_suffix' => 'suffix',
35       'type' => 'type',
36     ]);
37
38     // Ensure attributes are proper objects.
39     $this->preprocessAttributes();
40   }
41
42 }