function Media::validate
Same name in other branches
- 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::validate()
- 10 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::validate()
- 11.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::validate()
Overrides ContentEntityBase::validate
File
-
core/
modules/ media/ src/ Entity/ Media.php, line 457
Class
- Media
- Defines the media entity class.
Namespace
Drupal\media\EntityCode
public function validate() {
$media_source = $this->getSource();
if ($media_source instanceof MediaSourceEntityConstraintsInterface) {
$entity_constraints = $media_source->getEntityConstraints();
$this->getTypedData()
->getDataDefinition()
->setConstraints($entity_constraints);
}
if ($media_source instanceof MediaSourceFieldConstraintsInterface) {
$source_field_name = $media_source->getConfiguration()['source_field'];
$source_field_constraints = $media_source->getSourceFieldConstraints();
$this->get($source_field_name)
->getDataDefinition()
->setConstraints($source_field_constraints);
}
return parent::validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.