You are here

public function JsonFeedSerializer::validate in JSON Feed 8

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 StylePluginBase::validate

File

src/Plugin/views/style/JsonFeedSerializer.php, line 136

Class

JsonFeedSerializer
Default style plugin to render a JSON feed.

Namespace

Drupal\json_feed\Plugin\views\style

Code

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

  // Ensure there's a title.
  if (!$this->view->display_handler
    ->getOption('sitename_title') && !$this->view
    ->getTitle()) {
    $errors[] = $this
      ->t('The view must have a title');
  }
  return $errors;
}