function ViewsConfigUpdater::processDisplayHandlers

Same name 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. 10 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.

2 calls to ViewsConfigUpdater::processDisplayHandlers()
ViewsConfigUpdater::needsEntityArgumentUpdate in core/modules/views/src/ViewsConfigUpdater.php
Checks if 'numeric' arguments should be converted to 'entity_target_id'.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

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

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.