function OEmbedForm::getMediaType
Same name and namespace in other branches
- 9 core/modules/media_library/src/Form/OEmbedForm.php \Drupal\media_library\Form\OEmbedForm::getMediaType()
- 8.9.x core/modules/media_library/src/Form/OEmbedForm.php \Drupal\media_library\Form\OEmbedForm::getMediaType()
- 10 core/modules/media_library/src/Form/OEmbedForm.php \Drupal\media_library\Form\OEmbedForm::getMediaType()
Overrides AddFormBase::getMediaType
1 call to OEmbedForm::getMediaType()
- OEmbedForm::buildInputElement in core/
modules/ media_library/ src/ Form/ OEmbedForm.php - Builds the element for submitting source field value(s).
File
-
core/
modules/ media_library/ src/ Form/ OEmbedForm.php, line 82
Class
- OEmbedForm
- Creates a form to create media entities from oEmbed URLs.
Namespace
Drupal\media_library\FormCode
protected function getMediaType(FormStateInterface $form_state) {
if ($this->mediaType) {
return $this->mediaType;
}
$media_type = parent::getMediaType($form_state);
if (!$media_type->getSource() instanceof OEmbedInterface) {
throw new \InvalidArgumentException('Can only add media types which use an oEmbed source plugin.');
}
return $media_type;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.