You are here

public function SimpleSitemapViews::getIndexableArguments in Simple XML sitemap (Views integration) 8

Get indexable arguments for view display.

Parameters

\Drupal\views\ViewExecutable $view: A view executable instance.

string|null $display_id: The display id. If empty uses the preselected display.

Return value

array Indexable arguments identifiers.

1 call to SimpleSitemapViews::getIndexableArguments()
SimpleSitemapViews::addArgumentsToIndex in src/SimpleSitemapViews.php
Adds view arguments to the index.

File

src/SimpleSitemapViews.php, line 82
Contains simple_sitemap_views service.

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

public function getIndexableArguments(ViewExecutable $view, $display_id = NULL) {
  $indexable_arguments = [];
  $settings = $this
    ->getSitemapSettings($view, $display_id);
  if ($settings && !empty($settings['arguments']) && is_array($settings['arguments'])) {

    // Find indexable arguments.
    $arguments = array_keys($view->display_handler
      ->getHandlers('argument'));
    foreach ($arguments as $argument_id) {
      if (empty($settings['arguments'][$argument_id])) {
        break;
      }
      $indexable_arguments[] = $argument_id;
    }
  }
  return $indexable_arguments;
}