function cacheflush_advanced_preset_form_validate in CacheFlush 7
Same name and namespace in other branches
- 7.2 cacheflush_advanced/cacheflush_advanced.module \cacheflush_advanced_preset_form_validate()
Implements advanced preset validation.
1 string reference to 'cacheflush_advanced_preset_form_validate'
- cacheflush_advanced_form_alter in cacheflush_advanced/
cacheflush_advanced.module - Implements hook_form_alter().
File
- cacheflush_advanced/
cacheflush_advanced.module, line 110 - Cacheflush advanced preset form.
Code
function cacheflush_advanced_preset_form_validate(&$form, &$form_state) {
// Check for advanced preset.
if (isset($form_state['values']['vertical_tabs_advance']['cacheflush_advanced_table'])) {
foreach ($form_state['input']['vertical_tabs_advance']['cacheflush_advanced_table'] as $key => $value) {
if (isset($value['wildcard']) || $value['cid'] || $value['table']) {
if ($value['cid'] && $value['table']) {
unset($value['operations']);
$form_state['cacheflush_preset_list'][$form_state['cacheflush_preset_id']]['#cacheflush_preset_values']["advanced-preset-{$key}"] = array(
'is_table' => TRUE,
'query' => $value,
);
}
else {
if (isset($value['wildcard']) && (!$value['cid'] && !$value['table'])) {
form_error($form['vertical_tabs_advance']['cacheflush_advanced_table'][$key]['cid'], t('The cache ID field is mandatory.'));
form_error($form['vertical_tabs_advance']['cacheflush_advanced_table'][$key]['table'], t('The table field is mandatory.'));
}
elseif (!$value['cid']) {
form_error($form['vertical_tabs_advance']['cacheflush_advanced_table'][$key]['cid'], t('The cache ID field is mandatory.'));
}
else {
form_error($form['vertical_tabs_advance']['cacheflush_advanced_table'][$key]['table'], t('The table field is mandatory.'));
}
}
}
}
}
}