function theme_nodehierarchy_new_child_links in Node Hierarchy 7.2
Same name and namespace in other branches
- 5 nodehierarchy_theme.inc \theme_nodehierarchy_new_child_links()
- 6.3 nodehierarchy.module \theme_nodehierarchy_new_child_links()
- 6 nodehierarchy_theme.inc \theme_nodehierarchy_new_child_links()
- 6.2 nodehierarchy.module \theme_nodehierarchy_new_child_links()
- 7.4 nodehierarchy.admin.inc \theme_nodehierarchy_new_child_links()
Display links to create new children nodes of the given node
3 theme calls to theme_nodehierarchy_new_child_links()
- nodehierarchy_new_child_links in ./
nodehierarchy.module - Display links to create new children nodes of the given node
- nodehierarchy_views_embed_children in nodehierarchy_views/
nodehierarchy_views.module - Add the embedded children view to the node body if appropriate.
- nodehierarchy_view_children in ./
nodehierarchy.module - Display the children tab.
File
- ./
nodehierarchy.module, line 1751 - A module to make nodes hierarchical.
Code
function theme_nodehierarchy_new_child_links($variables) {
$node = $variables['node'];
$out = array();
$create_links = array();
if (user_access('create child nodes') && (user_access('create child of any parent') || node_access('update', $node))) {
foreach (nodehierarchy_get_allowed_child_types($node->type) as $key) {
if (node_access('create', $key)) {
$type_name = node_type_get_name($key);
$destination = (array) drupal_get_destination() + array(
'parent' => $node->nid,
);
$key = str_replace('_', '-', $key);
$title = t('Add a new %s.', array(
'%s' => $type_name,
));
$create_links[] = l($type_name, "node/add/{$key}", array(
'query' => $destination,
'attributes' => array(
'title' => $title,
),
));
}
}
if ($create_links) {
$out[] = array(
'#children' => '<div class="newchild">' . t("Create new child !s", array(
'!s' => implode(" | ", $create_links),
)) . '</div>',
);
}
}
return $out;
}