You are here

function form_builder_json_output in Form Builder 7

Same name and namespace in other branches
  1. 6 includes/form_builder.admin.inc \form_builder_json_output()
  2. 7.2 includes/form_builder.admin.inc \form_builder_json_output()

Generic function for outputing Form Builder JSON return responses.

Adds status messages, settings, and timestamp to a form builder JSON response and outputs it.

2 calls to form_builder_json_output()
form_builder_field_json in includes/form_builder.admin.inc
Menu callback to display a field as a JSON string.
_form_builder_add_element in includes/form_builder.admin.inc
Menu callback helper for adding or cloning a field.

File

includes/form_builder.admin.inc, line 769
form_builder.admin.inc Administrative interface for editing forms.

Code

function form_builder_json_output($data) {
  if (!isset($data['messages'])) {
    $data['messages'] = theme('status_messages');
  }
  if (!isset($data['settings'])) {
    $scripts = drupal_add_js();
    if (!empty($scripts['settings'])) {
      $data['settings'] = drupal_array_merge_deep_array($scripts['settings']['data']);
    }
  }
  if (!isset($data['time'])) {
    $data['time'] = time();
  }
  drupal_json_output($data);
}