You are here

function cer_entity_property_info_alter in Corresponding Entity References 7.3

Implements hook_entity_property_info_alter().

File

./cer.module, line 390

Code

function cer_entity_property_info_alter(array &$info) {

  // Add a 'chain' property to the cer_left and cer_right fields so we can
  // easily get the field's value represented as a CerFieldChain.
  $info['cer']['bundles']['cer']['properties']['cer_left']['property info'] = $info['cer']['bundles']['cer']['properties']['cer_right']['property info'] = array(
    'chain' => array(
      'label' => t('Chain'),
      'description' => t('A CER field chain to the field instance.'),
      'type' => 'struct',
      'getter callback' => 'cer_unpack_field_chain',
      'computed' => TRUE,
    ),
  );

  // Field collections are special. Because they live inside other entities (to
  // potentially infinite levels of recursion), their CER property callbacks must be
  // able to recurse upwards through the chain of embedding.
  if (module_exists('field_collection')) {
    $struct =& $info['field_collection_item']['properties']['cer']['property info'];
    $struct['lineage']['getter callback'] = 'cer_get_field_collection_lineage';
    $struct['lineage']['raw getter callback'] = 'cer_get_field_collection_lineage_array';
    $struct['depth']['getter callback'] = 'cer_get_field_collection_depth';
    $struct['owner']['getter callback'] = 'cer_get_field_collection_owner';
  }
}