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

8.0.x
Nathaniel Catchpole 2014-01-06 12:29:43 +00:00
parent 748abf1bb8
commit 3a0569596f
2 changed files with 51 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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.
*