protected function MediaEditForm::getTargetBundles in Media Directories 8
Same name and namespace in other branches
- 3.x modules/media_directories_ui/src/Form/MediaEditForm.php \Drupal\media_directories_ui\Form\MediaEditForm::getTargetBundles()
- 2.x modules/media_directories_ui/src/Form/MediaEditForm.php \Drupal\media_directories_ui\Form\MediaEditForm::getTargetBundles()
Get the allowed target bundles from the form state.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
array All allowed target bundle names.
Overrides AddMediaFormBase::getTargetBundles
File
- modules/
media_directories_ui/ src/ Form/ MediaEditForm.php, line 52
Class
- MediaEditForm
- Class MediaEditForm.
Namespace
Drupal\media_directories_ui\FormCode
protected function getTargetBundles(FormStateInterface $form_state) {
$medias = $form_state
->get('media');
if (is_array($medias)) {
$bundles = [];
foreach ($medias as $media) {
$bundles[] = $media
->bundle();
}
return $bundles;
}
return parent::getTargetBundles($form_state);
}