public function ViewsAccordion::validate in Views Accordion 8
Same name and namespace in other branches
- 2.0.x src/Plugin/views/style/ViewsAccordion.php \Drupal\views_accordion\Plugin\views\style\ViewsAccordion::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 StylePluginBase::validate
File
- src/
Plugin/ views/ style/ ViewsAccordion.php, line 322
Class
- ViewsAccordion
- Style plugin to render each item in an ordered or unordered list.
Namespace
Drupal\views_accordion\Plugin\views\styleCode
public function validate() {
$errors = parent::validate();
if (!$this
->usesFields()) {
$errors[] = $this
->t('Views accordion requires Fields as row style');
}
foreach ($this->options['grouping'] as $group) {
if (!$group['rendered'] && $group['use-grouping-header']) {
$errors[] = $this
->t('Views accordion requires "Use rendered output to group rows" enabled in order to use the group header as the Accordion header.');
}
// @TODO handle multiple grouping.
break;
}
if ($this->options['collapsible'] !== 1 && $this->options['row-start-open'] === 'none') {
$errors[] = $this
->t('Setting "Row to display opened on start" to "None" requires "Collapsible" to be enabled.');
}
return $errors;
}