entity_get_info

Versions
mediamosa-21
entity_get_info($entity_type = NULL)

Get the entity info array of an entity type.

See also

hook_entity_info()

@see hook_entity_info_alter()

Parameters

$entity_type The entity type, e.g. node, for which the info shall be returned, or NULL to return an array with info about all types.

▾ 18 functions call entity_get_info()

entity_create_stub_entity in includes/common.inc
Helper function to assemble an object structure with initial ids.
entity_extract_ids in includes/common.inc
Helper function to extract id, vid, and bundle name from an entity.
entity_get_controller in includes/common.inc
Get the entity controller class for an entity type.
entity_uri in includes/common.inc
Returns the uri elements of an entity.
field_attach_load in modules/field/field.attach.inc
Load all fields for the most current version of each of a set of entities of a single entity type.
field_create_field in modules/field/field.crud.inc
Creates a field.
field_extract_bundle in modules/field/field.module
Helper function to extract the bundle name of from a bundle object.
field_info_bundles in modules/field/field.info.inc
Returns information about existing bundles.
field_multilingual_check_translation_handlers in modules/field/field.multilingual.inc
Check if a module is registered as a translation handler for a given entity.
field_read_instances in modules/field/field.crud.inc
Reads in field instances that match an array of conditions.
field_sql_storage_field_storage_query in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_query().
field_test_field_storage_query in modules/field/tests/field_test.storage.inc
Implements hook_field_storage_query().
field_ui_menu in modules/field_ui/field_ui.module
Implements hook_menu().
field_ui_view_modes_tabs in modules/field_ui/field_ui.module
Group available view modes on tabs on the 'Manage display' page.
file_get_file_reference_count in modules/file/file.module
Count the number of times the file is referenced.
rdf_mapping_load in modules/rdf/rdf.module
Returns the mapping for attributes of a given type/bundle pair.
template_preprocess_field_ui_display_overview_form in modules/field_ui/field_ui.admin.inc
Theme preprocess function for field_ui-display-overview-form.tpl.php.
_field_info_prepare_instance in modules/field/field.info.inc
Prepares an instance definition for the current run-time context.

Code

includes/common.inc, line 6229

<?php
function entity_get_info($entity_type = NULL) {
  global $language;

  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['entity_info'] = &drupal_static(__FUNCTION__);
  }
  $entity_info = &$drupal_static_fast['entity_info'];

  // hook_entity_info() includes translated strings, so each language is cached
  // separately.
  $langcode = $language->language;

  if (empty($entity_info)) {
    if ($cache = cache_get("entity_info:$langcode")) {
      $entity_info = $cache->data;
    }
    else {
      $entity_info = module_invoke_all('entity_info');
      // Merge in default values.
      foreach ($entity_info as $name => $data) {
        $entity_info[$name] += array(
          'fieldable' => FALSE,
          'controller class' => 'DrupalDefaultEntityController',
          'static cache' => TRUE,
          'load hook' => $name . '_load',
          'bundles' => array(),
          'view modes' => array(),
          'object keys' => array(),
          'cacheable' => TRUE,
          'translation' => array(),
        );
        $entity_info[$name]['object keys'] += array(
          'revision' => '',
          'bundle' => '',
        );
        // If no bundle key is provided, assume a single bundle, named after
        // the entity type.
        if (empty($entity_info[$name]['object keys']['bundle']) && empty($entity_info[$name]['bundles'])) {
          $entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label']));
        }
      }
      // Let other modules alter the entity info.
      drupal_alter('entity_info', $entity_info);
      cache_set("entity_info:$langcode", $entity_info);
    }
  }

  if (empty($entity_type)) {
    return $entity_info;
  }
  elseif (isset($entity_info[$entity_type])) {
    return $entity_info[$entity_type];
  }
}
?>