function node_limit_limit_form_submit in Node Limit 7
Same name and namespace in other branches
- 8 old/node_limit.module \node_limit_limit_form_submit()
- 6 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 570
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']['limit']);
$limit['title'] = $form_state['values']['info']['title'];
$limit['weight'] = $form_state['values']['info']['weight'];
if (!empty($form_state['values']['node_limit_elements'])) {
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/structure/node_limit';
drupal_set_message(t('Saved limit "%limit"', array(
'%limit' => $limit['title'],
)));
}