Returns the specified entity's storage when the entity definition exists.
string $entity_type_id: The entity type ID.
\Drupal\Core\Entity\EntityStorageInterface|null The embed button's entity storage, or NULL if it does not exist.
protected function getEntityStorage(string $entity_type_id) {
$entity_type_manager = $this->container
->get('entity_type.manager');
assert($entity_type_manager instanceof EntityTypeManagerInterface);
try {
$storage = $entity_type_manager
->getStorage($entity_type_id);
} catch (PluginNotFoundException $e) {
// The entity type does not exist.
return NULL;
}
return $storage;
}