public function ViewsConditionalHandler::options_validate in Views Conditional 7
Check that everything is in order.
Overrides views_handler::options_validate
File
- includes/
views/ handlers/ views_conditional_handler.inc, line 139 - Handles conditionals in Views. IF xxx THEN yyy...
Class
- ViewsConditionalHandler
- @file Handles conditionals in Views. IF xxx THEN yyy...
Code
public function options_validate(&$form, &$form_state) {
$values =& $form_state['values']['options'];
if (empty($values['if']) || empty($values['condition']) || empty($values['equalto'])) {
if (empty($values['if'])) {
form_set_error('if', t("Please specify a valid field to run a condition on."));
}
if (empty($values['condition'])) {
form_set_error('condition', t("Please select a conditional operator."));
}
// We using there is_numeric because values '0', '0.0' counting as empty in PHP language.
if (empty($values['equalto']) && !in_array($values['condition'], array(
5,
6,
)) && !is_numeric($values['equalto'])) {
form_set_error('condition', t("Please specify something to compare with."));
}
}
}