You are here

protected function ArgumentCollector::getViewArgumentsFromRoute in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x modules/simple_sitemap_views/src/EventSubscriber/ArgumentCollector.php \Drupal\simple_sitemap_views\EventSubscriber\ArgumentCollector::getViewArgumentsFromRoute()

Get view arguments from current route.

Return value

array View arguments array.

1 call to ArgumentCollector::getViewArgumentsFromRoute()
ArgumentCollector::onTerminate in modules/simple_sitemap_views/src/EventSubscriber/ArgumentCollector.php
Collect information about views arguments.

File

modules/simple_sitemap_views/src/EventSubscriber/ArgumentCollector.php, line 96

Class

ArgumentCollector
Collect information about views arguments.

Namespace

Drupal\simple_sitemap_views\EventSubscriber

Code

protected function getViewArgumentsFromRoute() {

  // The code of this function is taken in part from the view page controller
  // method (Drupal\views\Routing\ViewPageController::handle()).
  $route = $this->routeMatch
    ->getRouteObject();
  $map = $route
    ->hasOption('_view_argument_map') ? $route
    ->getOption('_view_argument_map') : [];
  $args = [];
  foreach ($map as $attribute => $parameter_name) {
    $parameter_name = isset($parameter_name) ? $parameter_name : $attribute;
    $arg = $this->routeMatch
      ->getRawParameter($parameter_name);
    if ($arg !== NULL) {
      $args[] = $arg;
    }
  }
  return $args;
}