You are here

protected function ViewsConfigUpdater::processDisplayHandlers in Drupal 9

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

5 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::needsSortFieldIdentifierUpdate in core/modules/views/src/ViewsConfigUpdater.php
Updates the sort handlers by adding default sort field identifiers.
ViewsConfigUpdater::updateAll in core/modules/views/src/ViewsConfigUpdater.php
Performs all required updates.

File

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

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;
}