protected function DirectoryBrowser::prepareEntities in Media Directories 3.x
Same name and namespace in other branches
- 8 modules/media_directories_ui/src/Plugin/EntityBrowser/Widget/DirectoryBrowser.php \Drupal\media_directories_ui\Plugin\EntityBrowser\Widget\DirectoryBrowser::prepareEntities()
- 2.x modules/media_directories_ui/src/Plugin/EntityBrowser/Widget/DirectoryBrowser.php \Drupal\media_directories_ui\Plugin\EntityBrowser\Widget\DirectoryBrowser::prepareEntities()
1 call to DirectoryBrowser::prepareEntities()
- DirectoryBrowser::submit in modules/
media_directories_ui/ src/ Plugin/ EntityBrowser/ Widget/ DirectoryBrowser.php
File
- modules/
media_directories_ui/ src/ Plugin/ EntityBrowser/ Widget/ DirectoryBrowser.php, line 228
Class
- DirectoryBrowser
- Uses a view to provide entity listing in a browser's widget.
Namespace
Drupal\media_directories_ui\Plugin\EntityBrowser\WidgetCode
protected function prepareEntities(array $form, FormStateInterface $form_state) {
$selected_rows = array_values(array_filter($form_state
->getUserInput()['entity_browser_select']));
$entities = [];
foreach ($selected_rows as $row) {
list($type, $id) = explode(':', $row);
$storage = $this->entityTypeManager
->getStorage($type);
if ($entity = $storage
->load($id)) {
$entities[] = $entity;
}
}
return $entities;
}