You are here

function farm_livestock_weight_action_form in farmOS 7

Configuration form for farm_livestock_weight_action.

Parameters

array $context: The context passed into the action form function.

array $form_state: The form state passed into the action form function.

Return value

array Returns a form array.

File

modules/farm/farm_livestock/farm_livestock_weight/farm_livestock_weight.module, line 1043
Farm livestock weight module.

Code

function farm_livestock_weight_action_form(array $context, array $form_state) {

  // Date field.
  $form['date'] = array(
    '#type' => 'date_select',
    '#title' => t('Date'),
    '#date_format' => 'M j Y',
    '#date_type' => DATE_FORMAT_UNIX,
    '#date_year_range' => '-10:+3',
    '#default_value' => date('Y-m-d H:i', REQUEST_TIME),
    '#required' => TRUE,
  );

  // Weight.
  $form['weight'] = array(
    '#type' => 'textfield',
    '#title' => t('Weight'),
    '#description' => t('Enter the weight of the animal(s). If multiple animals are selected, enter the average animal weight.'),
    '#element_validate' => array(
      'element_validate_number',
    ),
    '#required' => TRUE,
  );

  // Units.
  $form['units'] = array(
    '#type' => 'textfield',
    '#title' => t('Units'),
    '#autocomplete_path' => 'taxonomy/autocomplete/field_farm_quantity_units',
    '#required' => TRUE,
  );

  // Return the form.
  return $form;
}