public function FocalPointPreviewController::getFocalPointImageStyles in Focal Point 8
Build a list of image styles that include an effect defined by focal point.
Return value
array An array of machine names of image styles that use a focal point effect.
1 call to FocalPointPreviewController::getFocalPointImageStyles()
- FocalPointPreviewController::content in src/
Controller/ FocalPointPreviewController.php
File
- src/
Controller/ FocalPointPreviewController.php, line 213
Class
- FocalPointPreviewController
- Class FocalPointPreviewController.
Namespace
Drupal\focal_point\ControllerCode
public function getFocalPointImageStyles() {
// @todo: Can this be generated? See $imageEffectManager->getDefinitions();
$focal_point_effects = [
'focal_point_crop',
'focal_point_scale_and_crop',
];
$styles_using_focal_point = [];
$styles = $this
->entityTypeManager()
->getStorage('image_style')
->loadMultiple();
foreach ($styles as $image_style_id => $style) {
foreach ($style
->getEffects() as $effect) {
$style_using_focal_point = in_array($effect
->getPluginId(), $focal_point_effects, TRUE);
if ($style_using_focal_point) {
$styles_using_focal_point[$image_style_id] = $style;
break;
}
}
}
return $styles_using_focal_point;
}