image.post_update.php

Same filename and directory in other branches
  1. 8.9.x core/modules/image/image.post_update.php
  2. 10 core/modules/image/image.post_update.php
  3. 11.x core/modules/image/image.post_update.php

Post-update functions for Image.

File

core/modules/image/image.post_update.php

View source
<?php


/**
 * @file
 * Post-update functions for Image.
 */
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\image\ImageConfigUpdater;

/**
 * Implements hook_removed_post_updates().
 */
function image_removed_post_updates() {
    return [
        'image_post_update_image_style_dependencies' => '9.0.0',
        'image_post_update_scale_and_crop_effect_add_anchor' => '9.0.0',
    ];
}

/**
 * Add the image loading attribute setting to image field formatter instances.
 */
function image_post_update_image_loading_attribute(?array &$sandbox = NULL) : void {
    $image_config_updater = \Drupal::classResolver(ImageConfigUpdater::class);
    \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (EntityViewDisplayInterface $view_display) use ($image_config_updater) : bool {
        return $image_config_updater->processImageLazyLoad($view_display);
    });
}

Functions

Title Deprecated Summary
image_post_update_image_loading_attribute Add the image loading attribute setting to image field formatter instances.
image_removed_post_updates Implements hook_removed_post_updates().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.