public function RssFields::validate in Views RSS 8.3
Same name in this branch
- 8.3 src/Plugin/views/style/RssFields.php \Drupal\views_rss\Plugin\views\style\RssFields::validate()
- 8.3 src/Plugin/views/row/RssFields.php \Drupal\views_rss\Plugin\views\row\RssFields::validate()
Same name and namespace in other branches
- 8.2 src/Plugin/views/row/RssFields.php \Drupal\views_rss\Plugin\views\row\RssFields::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
- src/
Plugin/ views/ row/ RssFields.php, line 129 - Definition of Drupal\views\Plugin\views\row\RssFields.
Class
- RssFields
- Renders an RSS item based on fields.
Namespace
Drupal\views_rss\Plugin\views\rowCode
public function validate() {
$errors = parent::validate();
if (!\Drupal::moduleHandler()
->moduleExists('views_rss_core')) {
$errors[] = $this
->t('You have to enable <em>Views RSS: Core Elements</em> module to have access to basic feed elements.');
}
else {
// An item MUST contain either a title or description.
// All other elements are optional according to RSS specification.
if (empty($this->options['item']['core']['views_rss_core']['title']) && empty($this->options['item']['core']['views_rss_core']['description'])) {
$errors[] = $this
->t('You have to configure either <em>title</em> or <em>description</em> core element.');
}
}
return $errors;
}