diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index e1aa330..5ef0370 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -347,7 +347,7 @@ public function getEffect($effect) { */ public function getEffects() { if (!$this->effectsCollection) { - $this->effectsCollection = new ImageEffectPluginCollection($this->getImageEffectPluginManager(), $this->effects, $this->id()); + $this->effectsCollection = new ImageEffectPluginCollection($this->getImageEffectPluginManager(), $this->effects, $this); $this->effectsCollection->sort(); } return $this->effectsCollection; diff --git a/core/modules/image/src/ImageEffectPluginCollection.php b/core/modules/image/src/ImageEffectPluginCollection.php index db51f2d..56688ec 100644 --- a/core/modules/image/src/ImageEffectPluginCollection.php +++ b/core/modules/image/src/ImageEffectPluginCollection.php @@ -15,11 +15,11 @@ class ImageEffectPluginCollection extends DefaultLazyPluginCollection { /** - * The unique ID of the image style using these effects. + * The image style using these effects. * - * @var string + * @var \Drupal\image\ImageStyleInterface */ - protected $imageStyleId; + protected $imageStyle; /** * Constructs a new ImageEffectPluginCollection object. @@ -29,12 +29,12 @@ class ImageEffectPluginCollection extends DefaultLazyPluginCollection { * @param array $configurations * An associative array containing the initial configuration for each plugin * in the collection, keyed by plugin instance ID. - * @param string $image_style_id - * The unique ID of the image style using these effects. + * @param \Drupal\image\ImageStyleInterface $image_style + * The image style using these effects. */ - public function __construct(ImageEffectManager $manager, array $configurations, $image_style_id) { + public function __construct(ImageEffectManager $manager, array $configurations, ImageStyleInterface $image_style) { parent::__construct($manager, $configurations); - $this->imageStyleId = $image_style_id; + $this->imageStyle = $image_style; } /** @@ -54,7 +54,7 @@ protected function initializePlugin($instance_id) { $plugin_instance = $this->pluginInstances[$instance_id]; if ($plugin_instance instanceof ImageStyleAwareInterface) { - $plugin_instance->setImageStyleId($this->imageStyleId); + $plugin_instance->setImageStyle($this->imageStyle); } } diff --git a/core/modules/image/src/ImageStyleAwareInterface.php b/core/modules/image/src/ImageStyleAwareInterface.php index ab68270..d31299f 100644 --- a/core/modules/image/src/ImageStyleAwareInterface.php +++ b/core/modules/image/src/ImageStyleAwareInterface.php @@ -13,13 +13,13 @@ interface ImageStyleAwareInterface { /** - * Sets the unique ID for the image style the effect belongs to. + * Sets image style the effect belongs to. * - * @param string $image_style_id - * The unique ID for the image style. + * @param string $image_style + * The image style. * * @return $this */ - public function setImageStyleId($image_style_id); + public function setImageStyle($image_style); } diff --git a/core/modules/image/src/ImageStyleAwareTrait.php b/core/modules/image/src/ImageStyleAwareTrait.php index 53c7c0d..854b3a5 100644 --- a/core/modules/image/src/ImageStyleAwareTrait.php +++ b/core/modules/image/src/ImageStyleAwareTrait.php @@ -17,13 +17,6 @@ trait ImageStyleAwareTrait { /** - * The unique ID image style this effect belongs to. - * - * @var string|null - */ - protected $imageStyleId; - - /** * The image style this effect belongs to. * * @var \Drupal\image\ImageStyleInterface @@ -31,10 +24,10 @@ protected $imageStyle; /** - * Implements \Drupal\image\ImageStyleAwareInterface::setImageStyleId(). + * Implements \Drupal\image\ImageStyleAwareInterface::setImageStyle(). */ - public function setImageStyleId($image_style_id) { - $this->imageStyleId = $image_style_id; + public function setImageStyle($image_style) { + $this->imageStyle = $image_style; return $this; } @@ -45,9 +38,6 @@ public function setImageStyleId($image_style_id) { * The image style this effect belongs to. */ protected function getImageStyle() { - if (!$this->imageStyle) { - $this->imageStyle = ImageStyle::load($this->imageStyleId); - } return $this->imageStyle; }