You are here

function radioactivity_update_emitters in Radioactivity 7.2

Update emitters on page

Parameters

$ajax boolean:

Return value

false|array

3 calls to radioactivity_update_emitters()
radioactivity_ajax_render_alter in ./radioactivity.module
Implements hook_ajax_render_alter(). This is one of the two ways the emitters end up on the page, the other is hook_page_alter().
radioactivity_page_alter in ./radioactivity.module
Implements hook_page_alter() This is one of the two ways the emitters end up on the page, the other is hook_ajax_render_alter().
radioactivity_rules_action_add_emitter in ./radioactivity.rules.inc
Action: Add emitter on page

File

./radioactivity.field.inc, line 364

Code

function radioactivity_update_emitters($ajax = FALSE) {
  $data = FALSE;
  $register = _radioactivity_register_emitter();
  module_load_include("inc", "radioactivity", "radioactivity-bootstrap");
  $path = base_path() . drupal_get_path('module', 'radioactivity') . '/emit.php';
  $config = array(
    'emitPath' => $path,
    'fpEnabled' => variable_get('radioactivity_flood_protection', FALSE),
    'fpTimeout' => variable_get('radioactivity_flood_timeout', 15),
  );
  if (count($register) > 0) {
    if ($ajax) {
      $data = array(
        'emitters' => $register,
        'config' => $config,
      );
    }
    else {
      drupal_add_library('system', 'jquery.cookie');
      drupal_add_js(drupal_get_path('module', 'radioactivity') . '/js/radioactivity.js');
      drupal_add_js(array(
        'radioactivity' => array(
          'emitters' => $register,
        ),
      ), 'setting');
      drupal_add_js(array(
        'radioactivity' => array(
          'config' => $config,
        ),
      ), 'setting');
    }
  }
  _radioactivity_register_emitter('RESET');
  if ($data) {
    return $data;
  }
}