// media wrapper when items are added. We set focus to the container
// because a media item does not necessarily have required fields and
// we do not want to set focus to the remove button automatically.
// @see ::updateFormCallback()
'tabindex' => '-1',
],
];
foreach ($added_media as $delta =>
$media) { $form['media'
][$delta] =
$this->
buildEntityFormElement($media,
$form,
$form_state,
$delta);
} $form['selection'
] =
$this->
buildCurrentSelectionArea($form,
$form_state);
$form['actions'
] =
$this->
buildActions($form,
$form_state);
} // Allow the current selection to be set in a hidden field so the selection
// can be passed between different states of the form. This field is filled
// via JavaScript so the default value should be empty.
// @see Drupal.behaviors.MediaLibraryItemSelection
$form['current_selection'
] =
[ '#type' => 'hidden',
'#default_value' => '',
'#attributes' =>
[