Mercurial > hg > isophonics-drupal-site
diff core/modules/image/image.post_update.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/modules/image/image.post_update.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/image/image.post_update.php Thu Feb 28 13:21:36 2019 +0000 @@ -5,6 +5,7 @@ * Post-update functions for Image. */ +use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityFormDisplay; @@ -20,3 +21,19 @@ $display->save(); } } + +/** + * Add 'anchor' setting to 'Scale and crop' effects. + */ +function image_post_update_scale_and_crop_effect_add_anchor(&$sandbox = NULL) { + \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'image_style', function ($image_style) { + /** @var \Drupal\image\ImageStyleInterface $image_style */ + $effects = $image_style->getEffects(); + foreach ($effects as $effect) { + if ($effect->getPluginId() === 'image_scale_and_crop') { + return TRUE; + } + } + return FALSE; + }); +}