You are here

function entity_get_property_info in Entity API 7

Get the entity property info array of an entity type.

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.

See also

hook_entity_property_info()

hook_entity_property_info_alter()

8 calls to entity_get_property_info()
EntityDefaultExtraFieldsController::__construct in ./entity.info.inc
Constructor.
EntityDefaultViewsController::schema_fields in views/entity.views.inc
Try to come up with some views fields with the help of the schema and the entity property information.
EntityDefaultViewsController::schema_revision_fields in views/entity.views.inc
Try to come up with some views fields with the help of the revision schema and the entity property information.
EntityDrupalWrapper::setUp in includes/entity.wrapper.inc
EntityMetadataTestCase::testEntityMetadataWrapper in ./entity.test
Creates a user and a node, then tests getting the properties.

... See full list

1 string reference to 'entity_get_property_info'
entity_property_info_cache_clear in includes/entity.property.inc
Resets the cached information of hook_entity_property_info().

File

includes/entity.property.inc, line 20
Provides API functions around hook_entity_property_info(). Also see entity.info.inc, which cares for providing entity property info for all core entity types.

Code

function entity_get_property_info($entity_type = NULL) {

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

  // hook_entity_property_info() includes translated strings, so each language
  // is cached separately.
  $langcode = $GLOBALS['language']->language;
  if (empty($info)) {
    if ($cache = cache_get("entity_property_info:{$langcode}")) {
      $info = $cache->data;
    }
    else {
      $info = module_invoke_all('entity_property_info');

      // Let other modules alter the entity info.
      drupal_alter('entity_property_info', $info);
      cache_set("entity_property_info:{$langcode}", $info);
    }
  }
  return empty($entity_type) ? $info : (isset($info[$entity_type]) ? $info[$entity_type] : array());
}