protected function AddFormBase::getPreSelectedMediaItems in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::getPreSelectedMediaItems()
- 9 core/modules/media_library/src/Form/AddFormBase.php \Drupal\media_library\Form\AddFormBase::getPreSelectedMediaItems()
Get all pre-selected media items from the form state.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The current form state.
Return value
\Drupal\media\MediaInterface[] An array containing the pre-selected media items keyed by ID.
2 calls to AddFormBase::getPreSelectedMediaItems()
- AddFormBase::buildCurrentSelectionArea in core/
modules/ media_library/ src/ Form/ AddFormBase.php - Returns a render array containing the current selection.
- AddFormBase::getCurrentMediaItems in core/
modules/ media_library/ src/ Form/ AddFormBase.php - Get all pre-selected and added media items from the form state.
File
- core/
modules/ media_library/ src/ Form/ AddFormBase.php, line 808
Class
- AddFormBase
- Provides a base class for creating media items from within the media library.
Namespace
Drupal\media_library\FormCode
protected function getPreSelectedMediaItems(FormStateInterface $form_state) {
// Get the pre-selected media items from the form state.
// @see ::processInputValues()
return $form_state
->get('current_selection') ?: [];
}