You are here

function farm_livestock_move_form_planned_movement_ajax in farmOS 7

Ajax callback for farm_livestock_move_form().

1 string reference to 'farm_livestock_move_form_planned_movement_ajax'
farm_livestock_move_form in modules/farm/farm_livestock/farm_livestock.farm_quick.move.inc
Form for adding animal movement logs.

File

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

Code

function farm_livestock_move_form_planned_movement_ajax($form, $form_state) {

  // Get the movement form element and CSS selector.
  $element = $form['move'];
  $selector = '#movement';

  // Build list of commands.
  $commands = array();

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

  // Add current location commands
  $commands = array_merge($commands, farm_livestock_move_form_current_location_commands($form, $form_state));

  // Add update movement commands
  $commands = array_merge($commands, farm_livestock_move_form_update_movement_commands($form, $form_state));

  // Return ajax commands.
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}