You are here

function entity_get_all_property_info in Entity API 7

Gets an array of info about all properties of a given entity type.

In contrast to entity_get_property_info(), this function returns info about all properties the entity might have, thus it adds an all properties assigned to entity bundles.

Parameters

$entity_type: (optiona) The entity type to return properties for.

Return value

array An array of info about properties. If the type is omitted, all known properties are returned.

8 calls to entity_get_all_property_info()
Entity::getTranslation in includes/entity.inc
Gets the raw, translated value of a property or field.
EntityDefaultI18nStringController::translatableProperties in ./entity.i18n.inc
Defines translatable properties used by self::hook_object_info().
entity_entity_property_edit_form_validate in ctools/relationships/entity_property.inc
entity_metadata_table_query in modules/callbacks.inc
Callback for querying entity properties having their values stored in the entities main db table.
entity_property_query in includes/entity.property.inc
Queries for entities having the given property value.

... See full list

File

includes/entity.property.inc, line 75
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_all_property_info($entity_type = NULL) {
  if (!isset($entity_type)) {

    // Retrieve all known properties.
    $properties = array();
    foreach (entity_get_info() as $entity_type => $info) {
      $properties += entity_get_all_property_info($entity_type);
    }
    return $properties;
  }

  // Else retrieve the properties of the given entity type only.
  $info = entity_get_property_info($entity_type);
  $info += array(
    'properties' => array(),
    'bundles' => array(),
  );

  // Add all bundle properties.
  foreach ($info['bundles'] as $bundle => $bundle_info) {
    $bundle_info += array(
      'properties' => array(),
    );
    $info['properties'] += $bundle_info['properties'];
  }
  return $info['properties'];
}