public function SimpleSitemapViews::getIndexableArguments in Simple XML sitemap 8.3
Same name and namespace in other branches
- 4.x modules/simple_sitemap_views/src/SimpleSitemapViews.php \Drupal\simple_sitemap_views\SimpleSitemapViews::getIndexableArguments()
Gets the indexable arguments for view display.
Parameters
\Drupal\views\ViewExecutable $view: A view executable instance.
string $variant: The name of the sitemap variant.
string|null $display_id: The display id. If empty uses the current display.
Return value
array Indexable arguments identifiers.
1 call to SimpleSitemapViews::getIndexableArguments()
- SimpleSitemapViews::addArgumentsToIndexByVariant in modules/
simple_sitemap_views/ src/ SimpleSitemapViews.php - Adds view arguments to the index by the sitemap variant.
File
- modules/
simple_sitemap_views/ src/ SimpleSitemapViews.php, line 205
Class
- SimpleSitemapViews
- Class to manage sitemap data for views.
Namespace
Drupal\simple_sitemap_viewsCode
public function getIndexableArguments(ViewExecutable $view, $variant, $display_id = NULL) {
$settings = $this
->getSitemapSettings($view, $variant, $display_id);
$indexable_arguments = [];
// Find indexable arguments.
if ($settings) {
$arguments = array_keys($view->display_handler
->getHandlers('argument'));
$bits = explode('/', $view
->getPath());
$arg_index = 0;
// Required arguments.
foreach ($bits as $bit) {
if ($bit == '%' || strpos($bit, '%') === 0) {
$indexable_arguments[] = isset($arguments[$arg_index]) ? $arguments[$arg_index] : $bit;
$arg_index++;
}
}
if (!empty($settings['arguments'])) {
if ($arg_index > 0) {
$arguments = array_slice($arguments, $arg_index);
}
// Optional arguments.
foreach ($arguments as $argument_id) {
if (empty($settings['arguments'][$argument_id])) {
break;
}
$indexable_arguments[] = $argument_id;
}
}
}
return $indexable_arguments;
}