ResponsiveImageStyle::calculateDependencies

public ResponsiveImageStyle::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php, line 199

Class

ResponsiveImageStyle
Defines the responsive image style entity.

Namespace

Drupal\responsive_image\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();
  $providers = \Drupal::service('breakpoint.manager')->getGroupProviders($this->breakpoint_group);
  foreach ($providers as $provider => $type) {
    $this->addDependency($type, $provider);
  }
  // Extract all the styles from the image style mappings.
  $styles = ImageStyle::loadMultiple($this->getImageStyleIds());
  array_walk($styles, function($style) {
    $this->addDependency('config', $style->getConfigDependencyName());
  });
  return $this;
}
doc_Drupal
2016-10-29 09:37:59
Comments
Leave a Comment

Please login to continue.