You are here

public function EntityConfigurationHandler::loadFromDatabase in Configuration Management 7.3

Loads the configuration from the database.

Parameters

string $identifier: The identifier of the configuration to load.

Return value

\Configuration\Configuration A configuration object.

Overrides ConfigurationHandler::loadFromDatabase

File

src/Handlers/EntityConfigurationHandler.php, line 29

Class

EntityConfigurationHandler

Namespace

Configuration\Handlers

Code

public function loadFromDatabase($identifier) {
  $name = $this
    ->getInternalId($identifier);
  $configuration = new Configuration();
  $configuration
    ->setIdentifier($identifier);
  $entity = $this->configuration_manager
    ->drupal()
    ->entity_load_single($this->type, $name);
  $entity_info = $entity
    ->entityInfo();
  $configuration
    ->addModule($entity_info['module']);
  $configuration
    ->setData($entity);
  $event = $this
    ->triggerEvent('load_from_database', $configuration);
  $info = $entity
    ->entityInfo();
  if (!empty($info['bundle of'])) {
    $event_settings = array(
      'entity_type' => $info['bundle of'],
      'bundle_name' => $name,
    );
    $event = $this
      ->triggerEvent('load_from_database.entity', $event->configuration, $event_settings, FALSE);
  }
  return $event->configuration;
}