You are here

public function RecipeML::validate in Recipe 8.2

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/RecipeML.php, line 177
Copyright (c) FormatData. All rights reserved.

Class

RecipeML
Default style plugin to render RecipeML.

Namespace

Drupal\recipe\Plugin\views\style

Code

public function validate() {
  $errors = parent::validate();
  $required_options = [
    'title_field',
    'ingredients_field',
    'directions_field',
  ];
  foreach ($required_options as $required_option) {
    if (empty($this->options[$required_option])) {
      $errors[] = $this
        ->t('Style plugin requires specifying which views fields to use for recipes.');
      break;
    }
  }
  return $errors;
}