function ViewsConfigUpdater::processOembedEagerLoadFieldHandler

Processes oembed 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.

1 call to ViewsConfigUpdater::processOembedEagerLoadFieldHandler()
ViewsConfigUpdater::needsOembedEagerLoadFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add eager load option to all oembed type field configurations.

File

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

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

protected function processOembedEagerLoadFieldHandler(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'] === 'oembed' && !array_key_exists('loading', $handler['settings'])) {
        $handler['settings']['loading'] = [
            'attribute' => 'eager',
        ];
        $changed = TRUE;
    }
    $deprecations_triggered =& $this->triggeredDeprecations['3212351'][$view->id()];
    if ($this->deprecationsEnabled && $changed && !$deprecations_triggered) {
        $deprecations_triggered = TRUE;
        @trigger_error(sprintf('The oEmbed loading attribute update for view "%s" is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Profile, module and theme provided configuration should be updated. See https://www.drupal.org/node/3275103', $view->id()), E_USER_DEPRECATED);
    }
    return $changed;
}

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