Issue #2030643 by tarekdj, InternetDevels: Expand ImageStyle with methods.
parent
748abf1bb8
commit
3a0569596f
|
@ -127,9 +127,9 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface {
|
|||
// 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 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface {
|
|||
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 @@ use Drupal\image\ImageEffectInterface;
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue