function ViewsConfigUpdater::processDisplayHandlers

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processDisplayHandlers()
  2. 8.9.x core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processDisplayHandlers()
  3. 11.x core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processDisplayHandlers()

Processes all display handlers.

Parameters

\Drupal\views\ViewEntityInterface $view: The View to update.

bool $return_on_changed: Whether processing should stop after a change is detected.

callable $handler_processor: A callback performing the actual update.

Return value

bool Whether the view was updated.

9 calls to ViewsConfigUpdater::processDisplayHandlers()
ViewsConfigUpdater::needsDefaultArgumentSkipUrlUpdate in core/modules/views/src/ViewsConfigUpdater.php
Checks for each view if default_argument_skip_url needs to be removed.
ViewsConfigUpdater::needsOembedEagerLoadFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add eager load option to all oembed type field configurations.
ViewsConfigUpdater::needsPagerHeadingUpdate in core/modules/views/src/ViewsConfigUpdater.php
Checks for each view if pagination_heading_level needs to be added.
ViewsConfigUpdater::needsRenderedEntityFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Checks for entity view display cache tags from rendered entity fields.
ViewsConfigUpdater::needsResponsiveImageLazyLoadFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add lazy load options to all responsive_image type field configurations.

... See full list

File

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

Class

ViewsConfigUpdater
Provides a BC layer for modules providing old configurations.

Namespace

Drupal\views

Code

protected function processDisplayHandlers(ViewEntityInterface $view, $return_on_changed, callable $handler_processor) {
    $changed = FALSE;
    $displays = $view->get('display');
    $handler_types = [
        'field' => 'fields',
        'argument' => 'arguments',
        'sort' => 'sorts',
        'relationship' => 'relationships',
        'filter' => 'filters',
        'pager' => 'pager',
    ];
    $compound_display_handlers = [
        'pager',
    ];
    foreach ($displays as $display_id => &$display) {
        foreach ($handler_types as $handler_type => $handler_type_lookup) {
            if (!empty($display['display_options'][$handler_type_lookup])) {
                if (in_array($handler_type_lookup, $compound_display_handlers)) {
                    if ($handler_processor($display['display_options'][$handler_type_lookup], $handler_type, NULL, $display_id)) {
                        $changed = TRUE;
                        if ($return_on_changed) {
                            return $changed;
                        }
                    }
                    continue;
                }
                foreach ($display['display_options'][$handler_type_lookup] as $key => &$handler) {
                    if (is_array($handler) && $handler_processor($handler, $handler_type, $key, $display_id)) {
                        $changed = TRUE;
                        if ($return_on_changed) {
                            return $changed;
                        }
                    }
                }
            }
        }
    }
    if ($changed) {
        $view->set('display', $displays);
    }
    return $changed;
}

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