class InputButton

Pre-processes variables for the "input__button" theme hook.

Plugin annotation

@BootstrapPreprocess("input__button")

Hierarchy

Expanded class hierarchy of InputButton

Related topics

Namespace

Drupal\bootstrap\Plugin\Preprocess
Source
class InputButton extends Input implements PreprocessInterface {

  /**
   * {@inheritdoc}
   */
  public function preprocessElement(Element $element, Variables $variables) {
    $element->colorize();
    $element->setButtonSize();
    $element->setIcon($element->getProperty('icon'));
    $variables['icon_only'] = $element->getProperty('icon_only');
    $variables['icon_position'] = $element->getProperty('icon_position');
    $variables['label'] = $element->getProperty('value');
    if ($element->getProperty('split')) {
      $variables->map([$variables::SPLIT_BUTTON]);
    }
    parent::preprocessElement($element, $variables);
  }

}

Members

Contains filters are case sensitive
Name Modifiers Type Description
InputButton::preprocessElement public function Preprocess the variables array if an element is present. Overrides Input::preprocessElement
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
PreprocessBase::$hook protected property The theme hook invoked.
PreprocessBase::$info protected property The theme hook info array from the theme registry.
PreprocessBase::$variables protected property The Variables object.
PreprocessBase::preprocess public function Preprocess theme hook variables. Overrides PreprocessInterface::preprocess
PreprocessBase::preprocessAttributes protected function Ensures all attributes have been converted to an Attribute object.
PreprocessBase::preprocessDescription protected function Converts any set description variable into a traversable array.
PreprocessBase::preprocessVariables protected function Preprocess the variables array.