public function AddFormBase::preRenderAddedMedia in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::preRenderAddedMedia()
Converts the set of newly added media into an item list for rendering.
Parameters
array $element: The render element to transform.
Return value
array The transformed render element.
File
- core/
modules/ media_library/ src/ Form/ AddFormBase.php, line 358
Class
- AddFormBase
- Provides a base class for creating media items from within the media library.
Namespace
Drupal\media_library\FormCode
public function preRenderAddedMedia(array $element) {
// Transform the element into an item list for rendering.
$element['#theme'] = 'item_list__media_library_add_form_media_list';
$element['#list_type'] = 'ul';
foreach (Element::children($element) as $delta) {
$element['#items'][$delta] = $element[$delta];
unset($element[$delta]);
}
return $element;
}