function bundle_inherit_bundle_get_children in Bundle Inherit 7
Get direct children bundles of the selected entity bundle.
5 calls to bundle_inherit_bundle_get_children()
- bundle_inherit_bundle_get_children_all in ./
bundle_inherit.module - Get all children bundles of the selected entity bundle.
- bundle_inherit_field_create_instance in ./
bundle_inherit.module - Implements hook_field_create_instance().
- bundle_inherit_field_delete_instance in ./
bundle_inherit.module - Implements hook_field_delete_instance().
- bundle_inherit_field_update_instance in ./
bundle_inherit.module - Implements hook_field_update_instance().
- bundle_inherit_get_tree in ./
bundle_inherit.module - Get bundles tree.
1 string reference to 'bundle_inherit_bundle_get_children'
- bundle_inherit_perform in ./
bundle_inherit.module - Perform necesary inherit operations.
File
- ./
bundle_inherit.module, line 167 - Bundle Inherit module.
Code
function bundle_inherit_bundle_get_children($entity_type, $bundle_parent) {
$children =& drupal_static(__FUNCTION__);
if (!isset($children[$entity_type])) {
$children[$entity_type] = array();
}
if (!isset($children[$entity_type][$bundle_parent])) {
$children[$entity_type][$bundle_parent] = array();
$entity_type_info = entity_get_info($entity_type);
$_children = db_select('bundle_inherit', 'bi')
->fields('bi', array(
'bundle',
))
->condition('bundle_parent', $bundle_parent)
->condition('entity_type', $entity_type)
->execute()
->fetchCol();
foreach ($_children as $child) {
$children[$entity_type][$bundle_parent][$child] = array(
'type' => $child,
'label' => $entity_type_info['bundles'][$child]['label'],
);
}
}
return $children[$entity_type][$bundle_parent];
}