898369cc4c391ca8ef434c8f38fac62c983db7c3
[yaffs-website] / src / Plugin / Preprocess / Select.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Preprocess\Input.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Preprocess;
8
9 use Drupal\bootstrap\Annotation\BootstrapPreprocess;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\bootstrap\Utility\Variables;
12
13 /**
14  * Pre-processes variables for the "select" theme hook.
15  *
16  * @ingroup plugins_preprocess
17  *
18  * @BootstrapPreprocess("select")
19  */
20 class Select extends PreprocessBase implements PreprocessInterface {
21
22   /**
23    * {@inheritdoc}
24    */
25   public function preprocessElement(Element $element, Variables $variables) {
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       'field_prefix' => 'prefix',
33       'field_suffix' => 'suffix',
34     ]);
35
36     // Ensure attributes are proper objects.
37     $this->preprocessAttributes();
38   }
39
40 }