You are here

public function Textimage::setStyle in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 src/Textimage.php \Drupal\textimage\Textimage::setStyle()

Set the image style.

Parameters

\Drupal\image\ImageStyleInterface $image_style: The image style to be used to derive the Textimage.

Return value

$this

Overrides TextimageInterface::setStyle

File

src/Textimage.php, line 297

Class

Textimage
Provides a Textimage.

Namespace

Drupal\textimage

Code

public function setStyle(ImageStyleInterface $image_style) {
  if ($this->style) {
    throw new TextimageException("Image style already set");
  }
  $this
    ->set('style', $image_style);
  $effects = @$this->style
    ->getEffects()
    ->getConfiguration();
  $this
    ->setEffects($effects);
  return $this;
}