function nodeconnect_add in Node Connect 7
Load cached form info and display links to each of the referenceable types
If there is only one it will redirect to that page. This is mostly a copy and hack up of the node add page.This page is directed to
See also
nodeconnect_add_button_submit
1 string reference to 'nodeconnect_add'
- nodeconnect_menu in ./
nodeconnect.module - Implements hook_menu().
File
- ./
nodeconnect.menu.inc, line 24 - Handles all nodeconnect menu item page callbacks
Code
function nodeconnect_add($cache_id) {
$content = array();
$cache = cache_get($cache_id);
$field = field_info_field($cache->data['field']);
$acceptable_types = $field['settings']['referenceable_types'];
foreach (system_admin_menu_block(menu_get_item("node/add")) as $key => $item) {
$type = str_replace("-", '_', str_replace("node/add/", "", $item['path']));
if (isset($acceptable_types[$type]) && $acceptable_types[$type]) {
$item['href'] = $item['href'] . "/{$cache_id}";
$content[$key] = $item;
}
}
if (sizeof($content) == 1) {
$item = array_pop($content);
drupal_goto($item['href']);
}
$output = theme('node_add_list', array(
'content' => $content,
));
$output .= l(t('Cancel'), "admin/nodeconnect/return/{$cache_id}");
return $output;
}