You are here

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

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

Load by entity type.

9 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_update_7008 in ./eck.install
Update 7008.
eck__bundle__add_validate in ./eck.bundle.inc
Bundle add form validation callback.

... See full list

File

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

Class

Bundle

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();
    $entity_bundles[$entity_type_name] = array_filter($bundles, function ($bundle) use ($entity_type_name) {
      return $entity_type_name == $bundle->entity_type;
    });
  }
  return isset($entity_bundles[$entity_type_name]) ? $entity_bundles[$entity_type_name] : array();
}