You are here

function heartbeat_activity_rules_action_message_id_js in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 heartbeat.admin.inc \heartbeat_activity_rules_action_message_id_js()

Callback function to add variables to the user activity actions forms

1 string reference to 'heartbeat_activity_rules_action_message_id_js'
hrules_menu in modules/heartbeat_rules/hrules.module
Implementation of hook_menu().

File

modules/heartbeat_rules/hrules.module, line 172
Heartbeat rules implementation module

Code

function heartbeat_activity_rules_action_message_id_js() {
  $message = heartbeat_message_load($_GET['message_id'], 'message_id');
  if (isset($message)) {
    $default_values = heartbeat_rule_action_get_variables($message, heartbeat_encode_message_variables($message->variables));
  }

  // Updating the drupal settings to be able to do one ahah request after another
  $javascript = drupal_add_js(NULL, NULL, 'header');

  // Final rendering callback.
  return drupal_json(array(
    'status' => TRUE,
    'data' => isset($default_values) ? $default_values : '',
    'message' => isset($message->message) ? $message->message : '',
    'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
  ));
}