function openlayers_geofield_geocode_ajax_callback in Openlayers 7.3
Return the altered form element from an AJAX request.
See also
openlayers_geofield_field_widget_form()
1 string reference to 'openlayers_geofield_geocode_ajax_callback'
- openlayers_geofield_field_widget_form in modules/
openlayers_geofield/ openlayers_geofield.module - Implements hook_field_widget_form().
File
- modules/
openlayers_geofield/ openlayers_geofield.module, line 584 - Openlayers Geofield integration.
Code
function openlayers_geofield_geocode_ajax_callback($form, $form_state) {
$button = $form_state['triggering_element'];
// Go one level up in the form, to the widgets container.
$element = drupal_array_get_nested_value($form, array_slice($button['#array_parents'], 0, -1));
// Return the map, but remove the '_weight' element inserted
// by the field API.
unset($element['_weight']);
return $element;
}