You are here

function _cer_entity_ids in Corresponding Entity References 7

Helper function. Returns entity "ID" keys.

Parameters

$entity_types Array containing "home" and "away" keys.:

4 calls to _cer_entity_ids()
cer_batch_update_existing_entities in ./cer.module
Batch Operation Callback
cer_delete in ./cer.crud.inc
$keys = array( 'home_entity_type' => $key[0], 'home_bundle' => $key[1], 'home_field' => $key[2], 'away_entity_type' => $key[3], 'away_bundle' => $key[4], 'away_field' =>…
cer_insert in ./cer.crud.inc
Add any corresponding references on node insertion.
cer_update in ./cer.crud.inc
$keys = array( 'home_entity_type' => $key[0], 'home_bundle' => $key[1], 'home_field' => $key[2], 'away_entity_type' => $key[3], 'away_bundle' => $key[4], 'away_field' =>…

File

./cer.module, line 299
Module file providing the "corresponding entity reference" module main functions.

Code

function _cer_entity_ids($entity_types = NULL) {
  $types = entity_get_info();
  foreach ($types as $key => $type) {
    $entity_type_ids[$key] = $type['entity keys']['id'];
  }
  if (isset($entity_types)) {
    $ids = array(
      'home' => $entity_type_ids[$entity_types['home']],
      'away' => $entity_type_ids[$entity_types['away']],
    );
    return $ids;
  }
  else {
    return $entity_type_ids;
  }
}