You are here

function date_get_entity_bundle in Date 8

Same name and namespace in other branches
  1. 7.3 date.module \date_get_entity_bundle()
  2. 7.2 date.module \date_get_entity_bundle()

Helper function to figure out the bundle name for an entity.

2 calls to date_get_entity_bundle()
date_repeat_field_page in date_repeat_field/date_repeat_field.module
A page to list all values for a repeating date.
date_repeat_field_show in date_repeat_field/date_repeat_field.module
See if the user can access repeat date info for this field.

File

./date.module, line 39
Defines date/time field types.

Code

function date_get_entity_bundle($entity_type, $entity) {
  switch ($entity_type) {
    case 'field_collection_item':
      $bundle = $entity->field_name;
      break;
    default:
      $bundle = field_extract_bundle($entity_type, $entity);
      break;
  }

  // If there is no bundle name, field_info() uses the entity name as the bundle
  // name in its arrays.
  if (empty($bundle)) {
    $bundle = $entity_type;
  }
  return $bundle;
}