You are here

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

Class

ImageStyleConfigurationHandler

Namespace

Configuration\Handlers

Code

public function loadFromDatabase($identifier) {
  $name = $this
    ->getInternalId($identifier);
  $configuration = new Configuration();
  $configuration
    ->setIdentifier($identifier);
  $style = $this->configuration_manager
    ->drupal()
    ->image_style_load($name);
  $this
    ->styleSanitize($style);

  // Reset the order of effects, this will help to generate always the same
  // hash for image styles that have been reverted.
  $effects_copy = array();
  if (!empty($style['effects'])) {
    foreach ($style['effects'] as $effect) {
      $configuration
        ->addModule($effect['module']);
      $effects_copy[] = $effect;
    }
  }
  $style['effects'] = $effects_copy;
  $configuration
    ->setData($style);
  $event = $this
    ->triggerEvent('load_from_database', $configuration);
  return $event->configuration;
}