You are here

public function FieldInstanceConfigurationHandler::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/FieldInstanceConfigurationHandler.php, line 36

Class

FieldInstanceConfigurationHandler

Namespace

Configuration\Handlers

Code

public function loadFromDatabase($identifier) {
  $name = $this
    ->getInternalId($identifier);
  list($entity_type, $bundle, $field_name) = explode('.', $name);
  $instance_info = field_info_instance($entity_type, $field_name, $bundle);
  $configuration = new Configuration();
  $configuration
    ->setIdentifier($identifier);
  if (empty($instance_info)) {
  }
  else {
    unset($instance_info['id']);
    unset($instance_info['field_id']);
    $configuration
      ->setData($instance_info);
    $configuration
      ->addModule($instance_info['widget']['module']);
  }
  $event = $this
    ->triggerEvent('load_from_database', $configuration);
  return $event->configuration;
}