function autoassignrole_page_form_submit in Auto Assign Role 7
Same name and namespace in other branches
- 7.2 autoassignrole.admin.inc \autoassignrole_page_form_submit()
Implements hook_form_submit().
File
- ./
autoassignrole.admin.inc, line 374 - Administrative functionality for auto assign role.
Code
function autoassignrole_page_form_submit($form_id, &$form_state) {
$page = array(
'rids' => serialize($form_state['values']['roles']),
'path' => $form_state['values']['path'],
'menu' => $form_state['values']['menu'],
'title' => $form_state['values']['title'],
'display' => $form_state['values']['display'],
);
$return = FALSE;
$op = $form_state['values']['op_term'];
switch ($op) {
case 'add':
$return = autoassignrole_add_page($page);
$operation = 'Created';
break;
case 'edit':
$id = $form_state['values']['id'];
$return = autoassignrole_update_page($page, $id);
$operation = 'Updated';
break;
}
if ($return) {
menu_rebuild();
drupal_set_message(t('Successfully @operation Page @page', array(
'@operation' => $operation,
'@page' => $page['title'],
)));
drupal_goto('admin/config/people/autoassignrole/pages');
}
else {
drupal_set_message(t('Unfortunately there has been an error and this page could not be %op', array(
'%op' => drupal_strtolower($operation),
)), 'error');
}
}