function ViewsConfigUpdater::processResponsiveImageLazyLoadFieldHandler

Processes responsive_image type fields.

Parameters

array $handler: A display handler.

string $handler_type: The handler type.

\Drupal\views\ViewEntityInterface $view: The View being updated.

Return value

bool Whether the handler was updated.

2 calls to ViewsConfigUpdater::processResponsiveImageLazyLoadFieldHandler()
ViewsConfigUpdater::needsResponsiveImageLazyLoadFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add lazy load options to all responsive_image type field configurations.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

core/modules/views/src/ViewsConfigUpdater.php, line 211

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

protected function processResponsiveImageLazyLoadFieldHandler(array &$handler, string $handler_type, ViewEntityInterface $view) : bool {
    $changed = FALSE;
    // Add any missing settings for lazy loading.
    if ($handler_type === 'field' && isset($handler['plugin_id'], $handler['type']) && $handler['plugin_id'] === 'field' && $handler['type'] === 'responsive_image' && !isset($handler['settings']['image_loading'])) {
        $handler['settings']['image_loading'] = [
            'attribute' => 'eager',
        ];
        $changed = TRUE;
    }
    return $changed;
}

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