You are here

protected function SimpleSitemapDisplayExtender::validateIndexedArguments 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::validateIndexedArguments()

Validate indexed arguments.

Parameters

array $indexed_arguments: Indexed arguments array.

Return value

array An array of error strings. This will be empty if there are no validation errors.

2 calls to SimpleSitemapDisplayExtender::validateIndexedArguments()
SimpleSitemapDisplayExtender::validate in modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Validate that the plugin is correct and can be saved.
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 384

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

protected function validateIndexedArguments(array $indexed_arguments) : array {
  $arguments = $this->displayHandler
    ->getHandlers('argument');
  $arguments = array_fill_keys(array_keys($arguments), 0);
  $arguments = array_merge($arguments, $indexed_arguments);
  reset($arguments);
  $errors = [];
  while (($argument = current($arguments)) !== FALSE) {
    $next_argument = next($arguments);
    if (empty($argument) && !empty($next_argument)) {
      $errors[] = $this
        ->t('To enable indexing of an argument, you must enable indexing of all previous arguments.');
      break;
    }
  }
  return $errors;
}