ViewsEntitySchemaSubscriber::processHandlers

protected ViewsEntitySchemaSubscriber::processHandlers(array $all_views, callable $process)

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 225

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);
          if ($handler_config === NULL) {
            unset($display['display_options'][$handler_type][$id]);
          }
        }
      }
    }
  }
}
doc_Drupal
2016-10-29 09:55:09
Comments
Leave a Comment

Please login to continue.