function ViewsEntitySchemaSubscriber::processHandlers

Same name in other branches
  1. 9 core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::processHandlers()
  2. 8.9.x core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::processHandlers()
  3. 11.x 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.

4 calls to ViewsEntitySchemaSubscriber::processHandlers()
ViewsEntitySchemaSubscriber::baseTableRename in core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
Updates views if a base table is renamed.
ViewsEntitySchemaSubscriber::dataTableAddition in core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
Updates views if a data table is added.
ViewsEntitySchemaSubscriber::dataTableRemoval in core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
Updates views if a data table is removed.
ViewsEntitySchemaSubscriber::dataTableRename in core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
Updates views if a data table is renamed.

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

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