You are here

public function SimpleSitemapDisplayExtender::validate in Simple XML sitemap 8.3

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

Validate that the plugin is correct and can be saved.

Return value

An array of error strings to tell the user what is wrong with this plugin.

Overrides PluginBase::validate

File

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

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

public function validate() {
  $errors = [
    parent::validate(),
  ];

  // Validate the argument options relative to the
  // current state of the view argument handlers.
  if ($this
    ->hasSitemapSettings()) {
    foreach (array_keys($this->variants) as $variant) {
      $settings = $this
        ->getSitemapSettings($variant);
      $errors[] = $this
        ->validateIndexedArguments($settings['arguments']);
    }
  }
  return array_merge([], ...$errors);
}