function nodeconnect_form_node_form_alter in Node Connect 7
Implements hook_form_node_form_alter()
If we are adding a new node we pass of to nodeconnect_add_node_form_alter(). If we are returning to the parent node we hand off to nodequeue_return_node_form_alter TODO: need to move this at somepoint so it can be with any entity
File
- ./
nodeconnect.module, line 65 - Handles the main hooks used by nodeconnect
Code
function nodeconnect_form_node_form_alter(&$form, &$form_state, $form_id) {
$child = isset($_REQUEST['child']);
// We can get the cid two different ways
// First we try the $_REQUEST param. if we do not getting it from there we try
// the arg(3) if we are on a add form. Also if we are on an add form we know that
// we are a child page.
if (isset($_REQUEST['build_cache_id']) && ($cid = $_REQUEST['build_cache_id']) || arg(1) == 'add' && ($cid = arg(3)) && ($child = TRUE)) {
$cache = cache_get($cid);
nodeconnect_include_form();
if ($child) {
$form_state['#nodeconnect_child_form'] = $cache;
}
if (isset($_REQUEST['return'])) {
unset($_REQUEST['build_cache_id']);
nodeconnect_return_node_form_alter($form, $form_state, $form_id, $cid, $cache);
}
}
// If this for is a child form lets add alter for that purpose
// Note that we are doing this here becuase when we retrun to a form it gets rebuild
// so this will get cuaght in the rebuild
if (isset($form_state['#nodeconnect_child_form'])) {
$cache = $form_state['#nodeconnect_child_form'];
module_load_include('inc', 'nodeconnect', 'nodeconnect.form');
nodeconnect_child_node_form_alter($form, $form_state, $form_id, $cache->cid, $cache);
}
}