You are here

public function RssFields::validate in Views (for Drupal 7) 8.3

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

lib/Drupal/views/Plugin/views/row/RssFields.php, line 114
Definition of Drupal\views\Plugin\views\row\RssFields.

Class

RssFields
Renders an RSS item based on fields.

Namespace

Drupal\views\Plugin\views\row

Code

public function validate() {
  $errors = parent::validate();
  $required_options = array(
    'title_field',
    'link_field',
    'description_field',
    'creator_field',
    'date_field',
  );
  foreach ($required_options as $required_option) {
    if (empty($this->options[$required_option])) {
      $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.');
      break;
    }
  }

  // Once more for guid.
  if (empty($this->options['guid_field_options']['guid_field'])) {
    $errors[] = t('Row style plugin requires specifying which views fields to use for RSS item.');
  }
  return $errors;
}