You are here

function farm_livestock_move_form_update_movement_commands in farmOS 7

Helper function to build update movement ajax commands.

2 calls to farm_livestock_move_form_update_movement_commands()
farm_livestock_move_form_next_location_ajax in modules/farm/farm_livestock/farm_livestock.farm_quick.move.inc
Ajax callback for farm_livestock_move_form().
farm_livestock_move_form_planned_movement_ajax in modules/farm/farm_livestock/farm_livestock.farm_quick.move.inc
Ajax callback for farm_livestock_move_form().

File

modules/farm/farm_livestock/farm_livestock.farm_quick.move.inc, line 534
Farm livestock move quick form.

Code

function farm_livestock_move_form_update_movement_commands($form, $form_state) {

  // Get the "wkt" form element and CSS selector.
  $element = $form['move']['area']['geometry']['data'];
  $selector = '#movement-geometry';

  // Assemble commands...
  $commands = array();

  // Replace the hidden field.
  $commands[] = ajax_command_replace($selector, render($element));

  // Execute Javascript to add WKT to the map.
  $commands[] = array(
    'command' => 'updateMovementLayer',
  );
  return $commands;
}