You are here

function radioactivity_get_field_profile in Radioactivity 7.2

Get an instance of incident storage by params

4 calls to radioactivity_get_field_profile()
radioactivity_cron in ./radioactivity.module
Implements hook_cron().
radioactivity_field_formatter_view in ./radioactivity.field.inc
Implements hook_field_formatter_view()
radioactivity_rules_action_add_emitter in ./radioactivity.rules.inc
Action: Add emitter on page
radioactivity_rules_action_emit in ./radioactivity.rules.inc
Action: Emit energy

File

./radioactivity.module, line 407
Radioactivity core functionality

Code

function radioactivity_get_field_profile($entity_type = NULL, $bundle = NULL, $field_name = NULL) {

  // required here for rules not to fail
  module_load_include("inc", "radioactivity", "radioactivity-bootstrap");
  static $cache = array();
  $key = $entity_type . ":" . $bundle . ":" . $field_name;
  if (isset($cache[$key])) {
    return $cache[$key];
  }
  $field_info = field_info_instance($entity_type, $field_name, $bundle);
  $profile = radioactivity_decay_profile_load($field_info['settings']['profile']);
  if (!$profile) {
    return FALSE;
  }

  // FIXME
  // Rather hackish -- fix in 3.x
  if (!isset($profile->storageObject)) {
    $profile->storageObject = _radioactivity_get_storage($profile->storage);
  }
  $cache[$key] = $profile;
  return $profile;
}