function views_handler_filter::build_group_validate
Validate the build group options form.
1 call to views_handler_filter::build_group_validate()
- views_handler_filter::options_validate in handlers/
views_handler_filter.inc - Simple validate handler.
1 method overrides views_handler_filter::build_group_validate()
- views_handler_filter_date::build_group_validate in handlers/
views_handler_filter_date.inc - Validate the build group options form.
File
-
handlers/
views_handler_filter.inc, line 691
Class
- views_handler_filter
- Base class for filters.
Code
public function build_group_validate($form, &$form_state) {
if (!empty($form_state['values']['options']['group_info'])) {
if (empty($form_state['values']['options']['group_info']['identifier'])) {
form_error($form['group_info']['identifier'], t('The identifier is required if the filter is exposed.'));
}
if (!empty($form_state['values']['options']['group_info']['identifier'])) {
$illegal_identifiers = array(
'value',
'q',
);
if (in_array($form_state['values']['options']['group_info']['identifier'], $illegal_identifiers)) {
form_error($form['group_info']['identifier'], t('This identifier is not allowed.'));
}
}
if (!$this->view->display_handler
->is_identifier_unique($form_state['id'], $form_state['values']['options']['group_info']['identifier'])) {
form_error($form['group_info']['identifier'], t('This identifier is used by another handler.'));
}
}
if (!empty($form_state['values']['options']['group_info']['group_items'])) {
foreach ($form_state['values']['options']['group_info']['group_items'] as $id => $group) {
if (empty($group['remove'])) {
// Check if the title is defined but value wasn't defined.
if (!empty($group['title'])) {
// No value is needed for 'empty' and 'not empty' operator.
if (!in_array($group['operator'], array(
'empty',
'not empty',
))) {
if (!is_array($group['value']) && trim($group['value']) == "" || is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) == 0) {
form_error($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.'));
}
}
}
// Check if the value is defined but title wasn't defined.
if (!is_array($group['value']) && trim($group['value']) != "" || is_array($group['value']) && count(array_filter($group['value'], '_views_array_filter_zero')) > 0) {
if (empty($group['title'])) {
form_error($form['group_info']['group_items'][$id]['title'], t('The title is required if value for this item is defined.'));
}
}
}
}
}
}