function _radioactivity_register_emitter in Radioactivity 7.2
3 calls to _radioactivity_register_emitter()
- 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_update_emitters in ./
radioactivity.field.inc - Update emitters on page
File
- ./
radioactivity.field.inc, line 117
Code
function _radioactivity_register_emitter($storage = NULL, $entity_type = NULL, $bundle = NULL, $field_name = NULL, $language = NULL, $entity_id = NULL, $settings = NULL) {
static $cache = array();
if ($storage == NULL) {
return $cache;
}
else {
if ($storage == 'RESET') {
$cache = array();
return;
}
}
$incident = $settings + array(
'storage' => $storage,
'entity_type' => $entity_type,
'bundle' => $bundle,
'field_name' => $field_name,
'language' => $language,
'entity_id' => $entity_id,
);
// Casting booleans to strings will avoid a scenario when
// boolean values in incident data are converted to strings
// involuntarily upon storing in javascript.
foreach ($incident as &$incident_value) {
if (is_bool($incident_value)) {
$incident_value = (string) $incident_value;
}
}
// Remove trash which may be injected by another module.
$keep = array(
'accuracy',
'bundle',
'energy',
'entity_id',
'entity_type',
'field_name',
'language',
'storage',
'type',
);
foreach ($incident as $key => $val) {
if (!in_array($key, $keep)) {
unset($incident[$key]);
}
}
$prepared_incident = _radioactivity_prepare_incident($incident);
@($cache['emitDefault'][$prepared_incident['checksum']] = $prepared_incident);
}