3de68810c1cb4ebe803d251214726eb4b15a2f58
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Preprocess / InputButton.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__button" theme hook.
10  *
11  * @ingroup plugins_preprocess
12  *
13  * @BootstrapPreprocess("input__button")
14  */
15 class InputButton extends Input implements PreprocessInterface {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function preprocessElement(Element $element, Variables $variables) {
21     $element->colorize();
22     $element->setButtonSize();
23     $element->setIcon($element->getProperty('icon'));
24     $variables['icon_only'] = $element->getProperty('icon_only');
25     $variables['icon_position'] = $element->getProperty('icon_position');
26     $variables['label'] = $element->getProperty('value');
27     if ($element->getProperty('split')) {
28       $variables->map([$variables::SPLIT_BUTTON]);
29     }
30     parent::preprocessElement($element, $variables);
31   }
32
33 }