You are here

function _radioactivity_possibly_remap_id in Radioactivity 5

Same name and namespace in other branches
  1. 6 radioactivity.inc \_radioactivity_possibly_remap_id()
3 calls to _radioactivity_possibly_remap_id()
radioactivity_delete_energy in ./radioactivity.module
radioactivity_get_energy in ./radioactivity.module
Reads energies for a node. Returns array of $dpid => $energy
_radioactivity_add_energy_internal in ./radioactivity.inc

File

./radioactivity.inc, line 46

Code

function _radioactivity_possibly_remap_id($oid, $oclass) {
  static $map = array();
  if (!isset($map[$oclass][$oid])) {
    $info = radioactivity_get_radioactivity_info();
    $function = isset($info['targets'][$oclass]['id_mapper']) ? $info['targets'][$oclass]['id_mapper'] : FALSE;
    if ($function) {
      $new_oid = $function($oid, $oclass);
    }
    else {
      $new_oid = $oid;
    }
    $map[$oclass][$oid] = $new_oid;
  }
  return $map[$oclass][$oid];
}