You are here

function openlayers_presets_ui_preset_ahah in Openlayers 6

OpenLayers AHAH

Function to handle the AHAH request of the openlayers form

1 string reference to 'openlayers_presets_ui_preset_ahah'
openlayers_presets_ui_menu in modules/openlayers_presets_ui/openlayers_presets_ui.module
Implementation of hook_menu().

File

modules/openlayers_presets_ui/includes/openlayers_presets_ui.ui.inc, line 876
This file holds the functions for the openlayers presets ui

Code

function openlayers_presets_ui_preset_ahah() {
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);

  // Get variables
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form_state['post'] = $form['#post'] = $_POST;
  $form['#programmed'] = $form['#redirect'] = FALSE;

  // Reprocess form with new form state
  drupal_process_form($form_id, $form, $form_state);

  // Rebuild form and remove any submot handlers
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);

  // Unset wrapper and create output
  unset($form['openlayers-ahah-wrapper-start'], $form['openlayers-ahah-wrapper-end']);
  $output = theme('status_messages') . drupal_render($form['layers']) . drupal_render($form['options']);

  // Final rendering callback.
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}