You are here

public function SimpleSitemapDisplayExtender::validate 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::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 223

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

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

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