custom/menu_helper/menu_helper_blocks/menu_helper_blocks.module, line 611
_menu_helper_blocks_redirect_to_node_form(&$form_state)Set 'Add content to menu' or 'Add page to book' block's form state values to a querystring and redirects to the full node form.
menu_helper_blocks_content_form_submit()
<?php
function _menu_helper_blocks_redirect_to_node_form(&$form_state) {
// All 'menu_helper_blocks' blocks prepend the 'block name' (content, book, or path) to all inputs
// The $block_name will be 'add_item_block_content' or 'add_item_block_book'.
$block_name = str_replace('_form', '', $form_state['values']['form_id']);
// Get values
$values = $form_state['values'];
// Remove submit button and default form values since they no applicable to node form
unset($values[$block_name .'_submit']);
unset($values['form_build_id']);
unset($values['form_token']);
unset($values['form_id']);
unset($values['op']);
// Set query param and remove block name from keys (aka input names).
foreach ($values as $key => $value) {
$query_params[ str_replace($block_name .'_', '', $key) ] = $value;
}
// Set destination query param
$query_params['destination'] = ((isset($_GET['q'])) ? $_GET['q'] : '<front>');
// Append the destination, with the current query string, to the $query_params.
$destination_params = $_GET; // Make a copy of the $_GET array
unset( $destination_params['q'] ); // Remove 'q' from the params
if ( count($destination_params) ) {
$query_params['destination'] .= '?'. drupal_query_string_encode($destination_params);
}
// Set redirect
$form_state['redirect'] = array(
'node/add/'. $query_params['type'],
drupal_query_string_encode($query_params),
);
}
?>