From 3a0569596fd426fa7c4b6eeddf858452fcb9ba2c Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Mon, 6 Jan 2014 12:29:43 +0000
Subject: [PATCH] Issue #2030643 by tarekdj, InternetDevels: Expand ImageStyle
 with methods.

---
 .../lib/Drupal/image/Entity/ImageStyle.php    | 25 +++++++++++++++--
 .../lib/Drupal/image/ImageStyleInterface.php  | 28 +++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
index aee3ffcdfca6..57869d485f7d 100644
--- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
+++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
@@ -127,9 +127,9 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont
       // Check whether field instance settings need to be updated.
       // In case no replacement style was specified, all image fields that are
       // using the deleted style are left in a broken state.
-      if ($new_id = $style->get('replacementID')) {
+      if ($new_id = $style->getReplacementID()) {
         // The deleted ID is still set as originalID.
-        $style->set('name', $new_id);
+        $style->setName($new_id);
         static::replaceImageStyle($style);
       }
     }
@@ -372,4 +372,25 @@ public function getExportProperties() {
     return $properties;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getReplacementID() {
+    return $this->get('replacementID');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getName() {
+    return $this->get('name');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setName($name) {
+    $this->set('name', $name);
+    return $this;
+  }
 }
diff --git a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
index 3783fc490106..27e1e0265357 100644
--- a/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
+++ b/core/modules/image/lib/Drupal/image/ImageStyleInterface.php
@@ -15,6 +15,34 @@
  */
 interface ImageStyleInterface extends ConfigEntityInterface {
 
+  /**
+   * Returns the replacement ID.
+   *
+   * @return string
+   *   The name of the image style to use as replacement upon delete.
+   */
+  public function getReplacementID();
+
+  /**
+   * Returns the image style.
+   *
+   * @return string
+   *   The name of the image style.
+   */
+  public function getName();
+
+  /**
+   * Sets the name of the image style.
+   *
+   * @param string $name
+   *   The name of the image style.
+   *
+   * @return \Drupal\image\ImageEffectInterface
+   *   The class instance this method is called on.
+   */
+  public function setName($name);
+
+
   /**
    * Returns the URI of this image when using this style.
    *
-- 
GitLab