function ViewsConfigUpdater::processDisplayHandlers

Same name in other branches
  1. 9 core/modules/views/src/ViewsConfigUpdater.php \Drupal\views\ViewsConfigUpdater::processDisplayHandlers()
  2. 10 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.

4 calls to ViewsConfigUpdater::processDisplayHandlers()
ViewsConfigUpdater::needsEntityLinkUrlUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add additional settings to the entity link field.
ViewsConfigUpdater::needsMultivalueBaseFieldUpdate in core/modules/views/src/ViewsConfigUpdater.php
Update field names for multi-value base fields.
ViewsConfigUpdater::needsOperatorDefaultsUpdate in core/modules/views/src/ViewsConfigUpdater.php
Add additional settings to the entity link field.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

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

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',
        'argument',
        'sort',
        'relationship',
        'filter',
    ];
    foreach ($displays as $display_id => &$display) {
        foreach ($handler_types as $handler_type) {
            $handler_type_plural = $handler_type . 's';
            if (!empty($display['display_options'][$handler_type_plural])) {
                foreach ($display['display_options'][$handler_type_plural] as $key => &$handler) {
                    if ($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.