You are here

function nodehierarchy_get_allowed_parent_types in Node Hierarchy 6.2

Same name and namespace in other branches
  1. 6.3 nodehierarchy.module \nodehierarchy_get_allowed_parent_types()
  2. 7.4 nodehierarchy.admin.inc \nodehierarchy_get_allowed_parent_types()
  3. 7.2 nodehierarchy.module \nodehierarchy_get_allowed_parent_types()

Get the allwed parent types for the given child type.

5 calls to nodehierarchy_get_allowed_parent_types()
nodehierarchy_node_can_be_child in ./nodehierarchy.module
Can a node be a child.
theme_nodehierarchy_menu_overview_form in ./nodehierarchy.module
Theme the menu overview form into a table respecting the node hierarchy rules.
_nodehierarchy_parent_options in ./nodehierarchy.module
Return a list of menu items that are valid possible parents for the given node.
_nodehierarchy_widgets_is_invalid_parent in nodehierarchy_widgets/nodehierarchy_widgets.module
Return a list of menu items that are valid possible parents for the given node.
_nodehierarchy_widgets_parent_autocomplete_options in nodehierarchy_widgets/nodehierarchy_widgets.module
Return a list of menu items that are valid possible parents for the given node.

File

./nodehierarchy.module, line 897
A module to make nodes hierarchical.

Code

function nodehierarchy_get_allowed_parent_types($child_type = NULL) {
  $parent_types = array();
  foreach (node_get_types() as $type => $info) {
    $allowed_children = array_filter(variable_get('nh_allowchild_' . $type, array()));
    if (empty($child_type) && !empty($allowed_children) || in_array($child_type, (array) $allowed_children, TRUE)) {
      $parent_types[] = $type;
    }
  }
  return array_unique($parent_types);
}