function workbench_access_settings_validate in Workbench Access 7
Check configuration.
If no access schemes are selected, things go boom. Due to the use of JS $states in the form, we can't just make fields required.
1 string reference to 'workbench_access_settings_validate'
- workbench_access_settings_form in ./
workbench_access.admin.inc - Settings form for Workbench Access configuration.
File
- ./
workbench_access.admin.inc, line 177 - Workbench Access admin file.
Code
function workbench_access_settings_validate($form, &$form_state) {
$values = $form_state['values'];
if (empty($values['workbench_access'])) {
form_set_error('workbench_access', t('You must select an access scheme.'));
}
$target = 'workbench_access_' . $values['workbench_access'];
$error = FALSE;
if (empty($values[$target])) {
$error = TRUE;
}
else {
// Can't run an empty() check on array_filter() inside an IF.
$selections = array_filter($values[$target]);
if (empty($selections)) {
$error = TRUE;
}
}
if ($error) {
form_set_error($target, t('You must enable at least one @type scheme.', array(
'@type' => $values['workbench_access'],
)));
}
}