You are here

function form_builder_json_output in Form Builder 6

Same name and namespace in other branches
  1. 7.2 includes/form_builder.admin.inc \form_builder_json_output()
  2. 7 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.

4 calls to form_builder_json_output()
form_builder_configure_page in includes/form_builder.admin.inc
Menu callback for configuring a field.
form_builder_field_json in includes/form_builder.admin.inc
Menu callback to display a field as a JSON string.
form_builder_remove_page in includes/form_builder.admin.inc
Menu callback for removing a field.
_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 830
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['setting'])) {
      $data['settings'] = call_user_func_array('array_merge_recursive', $scripts['setting']);
    }
  }
  if (!isset($data['time'])) {
    $data['time'] = time();
  }
  drupal_json($data);
}