You are here

public function ImageWidget::preprocessElement in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  2. 8 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  3. 8.2 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  4. 8.3 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  5. 8.4 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  6. 8.5 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  7. 8.6 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::preprocessElement()
  8. 8.7 themes/socialbase/src/Plugin/Preprocess/ImageWidget.php \Drupal\socialbase\Plugin\Preprocess\ImageWidget::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 ImageWidget::preprocessElement

File

themes/socialbase/src/Plugin/Preprocess/ImageWidget.php, line 25

Class

ImageWidget
Pre-processes variables for the "image_widget" theme hook.

Namespace

Drupal\socialbase\Plugin\Preprocess

Code

public function preprocessElement(Element $element, Variables $variables) {
  if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'edit-field-post-image-0-upload') {
    $variables['in_post'] = TRUE;
  }
  if (isset($variables['data']['remove_button'])) {
    $variables['data']['remove_button']['#button_type'] = 'flat';
  }
  parent::preprocessElement($element, $variables);
}