public function views_matrix_plugin_style_matrix::canRender in Views Matrix 7
Same name and namespace in other branches
- 8 includes/views_matrix_plugin_style_matrix.inc \views_matrix_plugin_style_matrix::canRender()
Validate row and colum header configuration set. This is only used during runtime. parent::validate() cannot be used because it breaks the Views UI.
File
- includes/
views_matrix_plugin_style_matrix.inc, line 259 - Class definition for views matrix plugin.
Class
- views_matrix_plugin_style_matrix
- @class Views Plugin Class
Code
public function canRender() {
$errors = parent::validate();
if (empty($this->options['xconfig']['field']) || empty($this->options['yconfig']['field'])) {
// Do not save without x field or y field.
$errors[] = t('Style @style requires an x and y field to be defined.', array(
'@style' => $this->definition['title'],
));
}
else {
// Check if fields exist still.
$options = $this->display->handler
->get_field_labels(TRUE);
if (!isset($options[$this->options['xconfig']['field']]) || !isset($options[$this->options['yconfig']['field']])) {
$errors[] = t('An x or y field is defined, but not does not exist.');
}
}
return $errors;
}