protected function Textimage::buildStyleFromEffects in Textimage 8.4
Same name and namespace in other branches
- 8.3 src/Textimage.php \Drupal\textimage\Textimage::buildStyleFromEffects()
Builds an image style from an array of effects.
The runtime style object does not get saved. It is used to be passed to ImageStyle::createDerivative() to build an image derivative.
Parameters
array $effects: An array of image effects.
Return value
\Drupal\image\ImageStyleInterface An image style object.
2 calls to Textimage::buildStyleFromEffects()
- Textimage::buildImage in src/
Textimage.php - Build the image via core ImageStyle::createDerivative() method.
- Textimage::process in src/
Textimage.php - Process the Textimage, with the required raw text.
File
- src/
Textimage.php, line 755
Class
- Textimage
- Provides a Textimage.
Namespace
Drupal\textimageCode
protected function buildStyleFromEffects(array $effects) {
$style = ImageStyle::create([]);
foreach ($effects as $effect) {
$effect_instance = $this->imageEffectManager
->createInstance($effect['id']);
$default_config = $effect_instance
->defaultConfiguration();
$effect['data'] = NestedArray::mergeDeep($default_config, $effect['data']);
$style
->addImageEffect($effect);
}
$style
->getEffects()
->sort();
return $style;
}