You are here

public function StylePluginBase::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/style/StylePluginBase.php, line 659
Definition of Drupal\views\Plugin\views\style\StylePluginBase.

Class

StylePluginBase
Base class to define a style plugin handler.

Namespace

Drupal\views\Plugin\views\style

Code

public function validate() {
  $errors = parent::validate();
  if ($this
    ->usesRowPlugin()) {
    $plugin = $this->displayHandler
      ->getPlugin('row');
    if (empty($plugin)) {
      $errors[] = t('Style @style requires a row style but the row plugin is invalid.', array(
        '@style' => $this->definition['title'],
      ));
    }
    else {
      $result = $plugin
        ->validate();
      if (!empty($result) && is_array($result)) {
        $errors = array_merge($errors, $result);
      }
    }
  }
  return $errors;
}