function cer_entity_property_info in Corresponding Entity References 7.3
Implements hook_entity_property_info().
File
- ./
cer.module, line 326
Code
function cer_entity_property_info() {
$properties = array();
foreach (entity_get_info() as $entity_type => $entity_info) {
// Expose a 'cer' struct on every entity type so that we can get special
// entity-specific information during processing. This stuff is wrapped in
// a struct to avoid namespace collisions, which can be disastrous.
//
// @see Issue #2223467
//
$properties[$entity_type]['properties']['cer'] = array(
'label' => t('CER'),
'description' => t('Information about the entity, used internally by CER.'),
'type' => 'struct',
'getter callback' => 'cer_get_cer_struct',
'computed' => TRUE,
'property info' => array(
// lineage is a chain string, in the format used by {cer}.a and {cer}.b.
// e.g., node:article:field_related_pages.
'lineage' => array(
'label' => t('Context'),
'description' => t("The entity's lineage, represented as a string."),
'type' => 'text',
'getter callback' => 'cer_get_entity_lineage',
'computed' => TRUE,
),
// The depth of the entity. The default callback will just return 1, since most
// entities don't live inside other entities (field collections are the main
// exception).
'depth' => array(
'label' => t('Depth'),
'description' => t("How deeply the entity is embedded."),
'type' => 'integer',
'getter callback' => 'cer_get_entity_depth',
'computed' => TRUE,
),
// The default callback returns the original entity because, as with the depth
// property, most entities don't live inside other entities.
'owner' => array(
'label' => t('Owner'),
'description' => t('The top-level entity under which this one is embedded.'),
'type' => 'entity',
'getter callback' => 'cer_get_entity_owner',
'computed' => TRUE,
),
// A wrapper around $entity->original that returns the current entity if there is
// no original version available (i.e., during bulk update).
'original' => array(
'label' => t('Original'),
'description' => t('The original entity (before update), or the current entity if an update has not occurred.'),
'type' => 'entity',
'getter callback' => 'cer_get_entity_original',
'computed' => TRUE,
),
),
);
}
return $properties;
}