You are here

function form_builder_field_configure in Form Builder 6

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

Form for editing a field.

1 string reference to 'form_builder_field_configure'
form_builder_configure_page in includes/form_builder.admin.inc
Menu callback for configuring a field.

File

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

Code

function form_builder_field_configure($form_state, $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);

  // Assemble a form made up of all the configurable properties that this type
  // of form supports.
  $form = array();
  foreach (form_builder_get_element_properties($form_type, $element['#form_builder']['element_type']) as $property => $property_settings) {
    if (isset($property_settings['form']) && function_exists($property_settings['form'])) {
      $function = $property_settings['form'];

      // Set a default value on the property to avoid notices.
      $element['#' . $property] = isset($element['#' . $property]) ? $element['#' . $property] : NULL;
      $form = array_merge($form, $function($form_state, $form_type, $element, $property));
    }
  }
  $form['#form_type'] = $form_type;
  $form['#form_id'] = $form_id;
  $form['#element_id'] = $element_id;
  $form['#element'] = $element;
  $form['#pre_render'][] = 'form_builder_field_configure_pre_render';
  $form['form_builder_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
    '#access' => !isset($_REQUEST['js']),
    '#weight' => 100,
  );
  return $form;
}