Commit 3a056959 authored by catch's avatar catch

Issue #2030643 by tarekdj, InternetDevels: Expand ImageStyle with methods.

parent 748abf1b
......@@ -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;
}
}
......@@ -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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment