You are here

protected function ArgumentCollector::getViewArgumentsFromRoute in Simple XML sitemap (Views integration) 8

Get view arguments from current route.

Return value

array View arguments array.

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

File

src/EventSubscriber/ArgumentCollector.php, line 98
Contains argument collector.

Class

ArgumentCollector
Collect information about views URLs.

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;
    if (($arg = $this->routeMatch
      ->getRawParameter($parameter_name)) !== NULL) {
      $args[] = $arg;
    }
  }
  return $args;
}