You are here

public function MediaLibraryWidget::preRenderWidget in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::preRenderWidget()
  2. 9 core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::preRenderWidget()

Prepares the widget's render element for rendering.

Parameters

array $element: The element to transform.

Return value

array The transformed element.

See also

::formElement()

File

core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php, line 605

Class

MediaLibraryWidget
Plugin implementation of the 'media_library_widget' widget.

Namespace

Drupal\media_library\Plugin\Field\FieldWidget

Code

public function preRenderWidget(array $element) {
  if (isset($element['open_button'])) {
    $element['#field_suffix']['open_button'] = $element['open_button'];
    unset($element['open_button']);
  }
  return $element;
}