function nodeconnect_add_edit_button_submit in Node Connect 7
Called when a new node is to be added.
we cache the current state and form and redirect to the nodeconnect_add page with an append build_cached_id
TODO: we should capture the current destination so that we can add that back when we return
1 string reference to 'nodeconnect_add_edit_button_submit'
- _nodeconnect_field_attach_form in ./
nodeconnect.form.inc - Implements of hook_field_attach_form().
File
- ./
nodeconnect.form.inc, line 68 - handles all form alters and submit functions for nodeconnect
Code
function nodeconnect_add_edit_button_submit(&$form, &$form_state) {
$cache_id = "nodeconnect-" . $form['#build_id'];
$field = $form_state['clicked_button']['#field'];
$key = $form_state['clicked_button']['#key'];
$language = $form[$field]['#language'];
$data = array(
'form' => $form,
'form_state' => $form_state,
'dest' => $_GET['q'],
'field' => $field,
'key' => $key,
'add_child' => $form_state['clicked_button']['#add_child'],
'nid' => $form_state['values'][$field][$language][$key]['nid'],
);
nodeconnect_cache_set($cache_id, $data);
unset($_GET['destination']);
if ($data['add_child']) {
$form_state['redirect'] = "admin/nodeconnect/add/{$cache_id}";
}
else {
if ($data['nid']) {
$form_state['redirect'] = "admin/nodeconnect/edit/{$cache_id}";
}
}
}