You are here

public static function Bundle::loadByEntityType in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 eck.classes.inc \Bundle::loadByEntityType()

Load the bundles of an entity type.

Parameters

EntityType $entity_type: An entity type object.

Return value

array An array with the bundles associated with the given entity type.

10 calls to Bundle::loadByEntityType()
drush_eck_entity_construction_kit in includes/eck.drush.inc
Implements drush_hook_command().
drush_eck_entity_construction_kit_all in includes/eck.drush.inc
Implements drush_hook_command().
eck_field_extra_fields in ./eck.module
Implements hook_field_extra_fields().
eck_permission in ./eck.module
Implements hook_permission().
eck_update_7008 in ./eck.install
Update 7008.

... See full list

File

./eck.classes.inc, line 724
Classes for all the different objects used in ECK.

Class

Bundle
A bundle database object.

Code

public static function loadByEntityType($entity_type) {
  $entity_bundles =& drupal_static(__FUNCTION__, array());
  $entity_type_name = $entity_type->name;
  if (!isset($entity_bundles[$entity_type_name])) {
    $entity_bundles[$entity_type_name] = array();
    $bundles = Bundle::loadAll();
    foreach ($bundles as $bundle) {
      if ($entity_type_name == $bundle->entity_type) {
        $entity_bundles[$entity_type_name][] = $bundle;
      }
    }
  }
  return isset($entity_bundles[$entity_type_name]) ? $entity_bundles[$entity_type_name] : array();
}