You are here

protected function SimpleSitemapDisplayExtender::validateIndexedArguments in Simple XML sitemap (Views integration) 8

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 src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Validate that the plugin is correct and can be saved.
SimpleSitemapDisplayExtender::validateOptionsForm in src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php
Validate the options form.

File

src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php, line 324
Contains Simple XML Sitemap display extender.

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

protected function validateIndexedArguments(array $indexed_arguments) {
  $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;
}