function node_limit_limit_form_submit in Node Limit 6
Same name and namespace in other branches
- 8 old/node_limit.module \node_limit_limit_form_submit()
- 7 node_limit.module \node_limit_limit_form_submit()
Submission hook for node_limit_limit_form.
Calls the submission hook on applied submodules to allow them to save their data.
File
- ./
node_limit.module, line 410 - Module to restrict the number of nodes a user or role may create.
Code
function node_limit_limit_form_submit($form_id, &$form_state) {
if (isset($form_state['values']['lid'])) {
$lid = $form_state['values']['lid'];
}
else {
$lid = _node_limit_next_limit_id();
}
$limit = array();
$limit['lid'] = $lid;
$limit['nlimit'] = intval($form_state['values']['info']['nlimit']);
$limit['title'] = $form_state['values']['info']['title'];
$limit['weight'] = $form_state['values']['info']['weight'];
foreach ($form_state['values']['node_limit_elements'] as $module => $element) {
if ($element['applies']) {
$limit[$module] = $element['element'];
}
}
node_limit_save($limit);
$form_state['redirect'] = 'admin/user/node_limit';
drupal_set_message(t('Saved limit "%limit"', array(
'%limit' => $limit['title'],
)));
}