You are here

function radioactivity_rules_action_emit in Radioactivity 7.2

Action: Emit energy

1 string reference to 'radioactivity_rules_action_emit'
radioactivity_rules_action_info in ./radioactivity.rules.inc
Implements hook_rules_action_info().

File

./radioactivity.rules.inc, line 146

Code

function radioactivity_rules_action_emit($field, $energy, $floodProtected) {
  $info = $field
    ->info();
  $field_name = $info['name'];
  $entity_type = $info['parent']
    ->type();
  $bundle = $info['parent']
    ->getBundle();
  $id = $info['parent']
    ->getIdentifier();
  $lang = LANGUAGE_NONE;
  if ($info['translatable']) {
    global $language;
    $lang = $language->language;
  }
  $profile = radioactivity_get_field_profile($entity_type, $bundle, $field_name);
  if ($profile && $profile->storageObject) {
    $profile->storageObject
      ->addIncident(new RadioactivityIncident($entity_type, $bundle, $field_name, $lang, $id, $energy, time(), $floodProtected));
  }
}