Skip to content
Snippets Groups Projects

Issue #3186353: Image effect to crop by aspect ratio only

Files
2
@@ -3,6 +3,7 @@
namespace Drupal\focal_point\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\focal_point\FocalPointEffectBase;
use Drupal\focal_point\Plugin\Field\FieldWidget\FocalPointImageWidget;
use Drupal\file\Entity\File;
use Drupal\Core\Session\AccountInterface;
@@ -211,15 +212,11 @@ class FocalPointPreviewController extends ControllerBase {
* An array of machine names of image styles that use a focal point effect.
*/
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) {
if ($effect instanceof FocalPointEffectBase) {
$styles_using_focal_point[$image_style_id] = $style;
break;
}
Loading