You are here

protected function ViewsEntitySchemaSubscriber::processHandlers in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::processHandlers()
  2. 9 core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::processHandlers()

Applies a callable onto all handlers of all passed in views.

Parameters

\Drupal\views\Entity\View[] $all_views: All views entities.

callable $process: A callable which retrieves a handler config array.

File

core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php, line 270

Class

ViewsEntitySchemaSubscriber
Reacts to changes on entity types to update all views entities.

Namespace

Drupal\views\EventSubscriber

Code

protected function processHandlers(array $all_views, callable $process) {
  foreach ($all_views as $view) {
    foreach (array_keys($view
      ->get('display')) as $display_id) {
      $display =& $view
        ->getDisplay($display_id);
      foreach (Views::getHandlerTypes() as $handler_type) {
        $handler_type = $handler_type['plural'];
        if (!isset($display['display_options'][$handler_type])) {
          continue;
        }
        foreach ($display['display_options'][$handler_type] as $id => &$handler_config) {
          $process($handler_config, $view);
          if ($handler_config === NULL) {
            unset($display['display_options'][$handler_type][$id]);
          }
        }
      }
    }
  }
}