function flot_fields_views_plugin_style::validate in Flot 7
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
- flot_views/
views/ flot_fields_views_plugin_style.inc, line 1024 - Style plugin for views
Class
- flot_fields_views_plugin_style
- @file Style plugin for views
Code
function validate() {
$errors = parent::validate();
$fields = $this->display->handler->handlers['field'];
$xfields = array();
foreach ($fields as $field) {
if ($field->options['flot']['axis'] == 'x') {
$xfields[] = $field->definition['group'] . ': ' . $field->definition['title'];
}
}
if (count($xfields) == 0) {
$errors[] = t('You need to specify a field for the x-axis');
}
elseif (count($xfields) > 1) {
$errors[] = t('You have specified more than one field for the x-axis (!fields)', array(
'!fields' => implode(', ', $xfields),
));
}
return $errors;
}