function MediaLibraryWidget::preRenderWidget

Same name in other branches
  1. 9 core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::preRenderWidget()
  2. 8.9.x core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php \Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::preRenderWidget()
  3. 10 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 613

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.