You are here

function _bundle_copy_bundle_info in Bundle Copy 7.2

Same name and namespace in other branches
  1. 7 bundle_copy.module \_bundle_copy_bundle_info()

Return bundles for a certain entity type.

Parameters

$entity_type: The name of the entity type.

$table_select: Whether we're returning for the table select or not.

3 calls to _bundle_copy_bundle_info()
bundle_copy_clone in ./bundle_copy.module
Menu callback: present the clone page.
bundle_copy_export in ./bundle_copy.module
Menu callback: present the export page.
bundle_copy_import_process in ./bundle_copy.module

File

./bundle_copy.module, line 477
Bundle copy.

Code

function _bundle_copy_bundle_info($entity_type, $table_select = FALSE) {
  static $bundles = array();
  if (!isset($bundles[$entity_type])) {
    $bundles[$entity_type] = array();
    $entity_info = entity_get_info($entity_type);
    $entity_bundles = $entity_info['bundles'];
    ksort($entity_bundles);
    foreach ($entity_bundles as $key => $info) {
      $label = isset($info['label']) ? $info['label'] : drupal_ucfirst(str_replace('_', ' ', $key));
      if ($table_select) {
        $bundles[$entity_type][$key]['label'] = $label;
      }
      else {
        $bundles[$entity_type][$key] = $label;
      }
    }
  }
  return $bundles[$entity_type];
}