You are here

public function InputButton::preprocessElement in Open Social 8

Same name and namespace in other branches
  1. 8.9 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  2. 8.2 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  3. 8.3 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  4. 8.4 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  5. 8.5 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  6. 8.6 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  7. 8.7 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()
  8. 8.8 themes/socialbase/src/Plugin/Preprocess/InputButton.php \Drupal\socialbase\Plugin\Preprocess\InputButton::preprocessElement()

Preprocess the variables array if an element is present.

Parameters

\Drupal\bootstrap\Utility\Element $element: The Element object.

\Drupal\bootstrap\Utility\Variables $variables: The Variables object.

Overrides InputButton::preprocessElement

File

themes/socialbase/src/Plugin/Preprocess/InputButton.php, line 21

Class

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

Namespace

Drupal\socialbase\Plugin\Preprocess

Code

public function preprocessElement(Element $element, Variables $variables) {
  $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);
  $variables['attributes']
    ->removeClass('btn-default');
}