protected function MediaEditForm::getMediaType in Media Directories 8
Same name and namespace in other branches
- 2.x modules/media_directories_ui/src/Form/MediaEditForm.php \Drupal\media_directories_ui\Form\MediaEditForm::getMediaType()
Get the media type from the form state.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The current form state.
Return value
\Drupal\media\MediaTypeInterface The media type.
Throws
\InvalidArgumentException If the selected media type does not exist.
Overrides AddMediaFormBase::getMediaType
File
- modules/
media_directories_ui/ src/ Form/ MediaEditForm.php, line 41
Class
- MediaEditForm
- Class MediaEditForm.
Namespace
Drupal\media_directories_ui\FormCode
protected function getMediaType(FormStateInterface $form_state) {
if (isset($this->media)) {
return $this->entityTypeManager
->getStorage('media_type')
->load($this->media
->bundle());
}
return parent::getMediaType($form_state);
}