You are here

function bundle_inherit_get_tree in Bundle Inherit 7

Get bundles tree.

2 calls to bundle_inherit_get_tree()
bundle_inherit_node_overview_types in bundle_inherit_node/bundle_inherit_node.module
Redeclare content types admin page. Sort and add indention to the inherited types.
bundle_inherit_sort_rows in ./bundle_inherit.module
Sort rows hierarchycly and allow to indent them.

File

./bundle_inherit.module, line 425
Bundle Inherit module.

Code

function bundle_inherit_get_tree($entity_type, $parent_bundle_type = '', $depth = 0) {
  if ($depth == 0) {
    $tree =& drupal_static(__FUNCTION__ . ':' . $parent_bundle_type);
  }
  if (!isset($tree)) {
    $tree = array();
    $entity_type_info = entity_get_info($entity_type);
    $children = bundle_inherit_bundle_get_children($entity_type, $parent_bundle_type);
    foreach ($children as $child) {
      $tree[$child['type']] = array(
        'type' => $child['type'],
        'label' => $child['label'],
        'depth' => $depth,
      );
      $tree = array_merge($tree, bundle_inherit_get_tree($entity_type, $child['type'], $depth + 1));
    }
  }
  return $tree;
}