protected function AssertMediaTrait::assertIsMediaEntity in Gutenberg 8.2
Same name and namespace in other branches
- 8 src/AssertMediaTrait.php \Drupal\gutenberg\AssertMediaTrait::assertIsMediaEntity()
Assert if provided entity is type of MediaInterface.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: Entity instance to check.
Throws
\Exception
1 call to AssertMediaTrait::assertIsMediaEntity()
- MediaEntityRenderer::renderArray in src/
MediaEntityRenderer.php - Return the media entity render array.
File
- src/
AssertMediaTrait.php, line 38
Class
- AssertMediaTrait
- Provides utility to assert data.
Namespace
Drupal\gutenbergCode
protected function assertIsMediaEntity(ContentEntityInterface $entity) {
if (!$entity instanceof MediaInterface) {
throw new \Exception(sprintf('Entity must by type of %s.', MediaInterface::class));
}
}