You are here

function quicktabs_style_plugin::validate in Quick Tabs 7.3

Same name and namespace in other branches
  1. 6.3 includes/quicktabs_style_plugin.inc \quicktabs_style_plugin::validate()
  2. 6.2 includes/quicktabs_style_plugin.inc \quicktabs_style_plugin::validate()

Validate that the plugin is correct and can be saved.

Return value

array An array of error strings to tell the user what is wrong with this plugin.

Overrides views_plugin_style::validate

File

includes/quicktabs_style_plugin.inc, line 64
Add Quicktabs style plugins to Views.

Class

quicktabs_style_plugin
Style plugin to display Quicktabs.

Code

function validate() {
  $errors = parent::validate();

  // Ensure that we're using the field row style.
  if (!$this->row_plugin
    ->uses_fields()) {
    $errors[] = t('Display "@display" uses the "@style" row style, but the Quicktabs display style requires use of the "Fields" row style.', array(
      '@display' => $this->display->display_title,
      '@style' => $this->row_plugin->definition['title'],
    ));
  }

  // Ensure that a valid tab title field is selected.
  $fields = $this->display->handler
    ->get_handlers('field');
  if (empty($this->options['tab_title_field']) || !isset($fields[$this->options['tab_title_field']])) {
    $errors[] = t('The Quicktabs display style requires that a field be configured to be used as the tab title.');
  }
  return $errors;
}