You are here

public function SimpleSitemapDisplayExtender::getRequiredArguments in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php \Drupal\simple_sitemap_views\Plugin\views\display_extender\SimpleSitemapDisplayExtender::getRequiredArguments()

Gets required view arguments (presented in the path).

Return value

array View arguments IDs.

3 calls to SimpleSitemapDisplayExtender::getRequiredArguments()
SimpleSitemapDisplayExtender::buildOptionsForm in modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Provide a form to edit options for this plugin.
SimpleSitemapDisplayExtender::getSitemapSettings in modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Gets the sitemap settings.
SimpleSitemapDisplayExtender::validateOptionsForm in modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Validate the options form.

File

modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php, line 316

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

public function getRequiredArguments() : array {
  $arguments = $this->displayHandler
    ->getHandlers('argument');
  if (!empty($arguments)) {
    $bits = explode('/', $this->displayHandler
      ->getPath());
    $arg_counter = 0;
    foreach ($bits as $bit) {
      if ($bit === '%' || strpos($bit, '%') === 0) {
        $arg_counter++;
      }
    }
    if ($arg_counter > 0) {
      $arguments = array_slice(array_keys($arguments), 0, $arg_counter);
      return array_combine($arguments, $arguments);
    }
  }
  return [];
}