function _nodehierarchy_get_parent_pulldown in Node Hierarchy 6
Same name and namespace in other branches
- 5 nodehierarchy.module \_nodehierarchy_get_parent_pulldown()
Get the parent selector pulldown.
1 call to _nodehierarchy_get_parent_pulldown()
- nodehierarchy_nodehierarchyapi in ./
nodehierarchy.module - Implementation of hook_nodehierarchyapi(). Responds to own api calls.
File
- ./
nodehierarchy.module, line 1090
Code
function _nodehierarchy_get_parent_pulldown($child_type, $default, $title, $nid = NULL) {
// $child_type is currently unused.
$out = array();
$types = array();
foreach (node_get_types() as $key => $type) {
if (variable_get('nh_parent_' . $key, FALSE)) {
$types[] = "'{$key}'";
}
}
if ($types) {
$items = array(
0 => '-- ' . t('NONE') . ' --',
);
$items += _nodehierarchy_get_parent_pulldown_items(0, $types, $nid);
// add the default if it's not alredy there.
if (!isset($items[$default])) {
$default_node = node_load($default);
$items += array(
$default => $default_node->title,
);
}
$out = array(
'#type' => 'select',
'#title' => $title,
'#default_value' => $default,
'#options' => $items,
);
}
return $out;
}