You are here

function form_builder_field_json in Form Builder 7

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

Menu callback to display a field as a JSON string.

2 calls to form_builder_field_json()
form_builder_field_configure_submit in includes/form_builder.admin.inc
form_builder_field_remove_submit in includes/form_builder.admin.inc
1 string reference to 'form_builder_field_json'
form_builder_menu in ./form_builder.module
Implementation of hook_menu().

File

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

Code

function form_builder_field_json($form_type, $form_id, $element_id) {
  module_load_include('inc', 'form_builder', 'includes/form_builder.api');
  module_load_include('inc', 'form_builder', 'includes/form_builder.cache');
  $element = form_builder_cache_field_load($form_type, $form_id, $element_id);
  $data = array(
    'formType' => $form_type,
    'formId' => $form_id,
    'elementId' => $element_id,
    'html' => !empty($element) ? form_builder_field_render($form_type, $form_id, $element_id) : '',
    'errors' => form_get_errors(),
  );
  form_builder_json_output($data);
  exit;
}