function front_page_admin_validate in Front Page 7.2
Same name and namespace in other branches
- 6.2 front_page.admin.inc \front_page_admin_validate()
Validation hook for front_page_admin.
File
- ./
front_page.admin.inc, line 137 - Admin page callbacks for the front page module.
Code
function front_page_admin_validate($form, &$form_state) {
if (is_array($form_state['values']['roles'])) {
foreach ($form_state['values']['roles'] as $rid => $role) {
switch ($role['mode']) {
case 'themed':
case 'full':
if (empty($role['data_wrapper']['data']['value'])) {
form_set_error('roles][' . $rid . '][data][value', 'You must set the data field for ' . $role['mode'] . ' mode.');
}
break;
case 'redirect':
if (empty($role['path'])) {
form_set_error('roles][' . $rid . '][path', 'You must set the path field for redirect mode.');
}
break;
case 'alias':
if (empty($role['path'])) {
form_set_error('roles][' . $rid . '][path', 'You must set the path field for alias mode.');
}
elseif (!preg_match('@^[^?#]+$@', $role['path'])) {
form_set_error('roles][' . $rid . '][path', 'You must set only the URI part of a URL in alias mode.');
}
break;
}
}
}
}