You are here

protected function ContentModelUpdater::getConfigEntityClass in Panopoly 8.2

Get the class for a config entity type by provider and config prefix.

Parameters

string $provider: The provider (module).

string $type: The config type.

Return value

string The class name of the configuration entity class.

2 calls to ContentModelUpdater::getConfigEntityClass()
ContentModelUpdater::createConfigEntity in modules/panopoly/panopoly_media/src/Update/ContentModelUpdater.php
Creates a config entity.
ContentModelUpdater::getConfigEntity in modules/panopoly/panopoly_media/src/Update/ContentModelUpdater.php
Gets a configuration entity.

File

modules/panopoly/panopoly_media/src/Update/ContentModelUpdater.php, line 991

Class

ContentModelUpdater
Applies changes to media content model from schema versions 8204 to 8205.

Namespace

Drupal\panopoly_media\Update

Code

protected function getConfigEntityClass($provider, $type) {
  foreach ($this
    ->getEntityTypeManager()
    ->getDefinitions() as $definition) {
    if ($definition
      ->getProvider() == $provider) {
      if ($type == $definition
        ->id() || $definition
        ->get('config_prefix') == $type) {
        return $definition
          ->getClass();
      }
    }
  }
  throw new \Exception(sprintf('Config entity class not found for "%s.%s".', $provider, $type));
}