You are here

function views_plugin_style::validate in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_style.inc \views_plugin_style::validate()
  2. 7.3 plugins/views_plugin_style.inc \views_plugin_style::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 views_plugin::validate

File

plugins/views_plugin_style.inc, line 349

Class

views_plugin_style
Base class to define a style plugin handler.

Code

function validate() {
  $errors = parent::validate();
  if ($this
    ->uses_row_plugin()) {
    $plugin = $this->display->handler
      ->get_plugin('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;
}