function farm_livestock_form_log_form_alter in farmOS 7
Implements hook_form_FORM_ID_alter().
File
- modules/
farm/ farm_livestock/ farm_livestock.module, line 421
Code
function farm_livestock_form_log_form_alter(&$form, &$form_state, $form_id) {
// Only act on the birth log form.
if (!(!empty($form['log']['#value']->type) && $form['log']['#value']->type == 'farm_birth')) {
return;
}
// If this is a new birth log form, display a link to the birth quick form
// for convenience.
if (!empty($form['log']['#value']->is_new)) {
drupal_set_message(t('Tip: Use the <a href="@path">Birth Quick Form</a> to quickly record animal births and create child animal records at the same time.', array(
'@path' => url('farm/quick/birth'),
)));
}
// Add validation to make sure that the same child is not referenced in
// multiple birth logs.
$form['#validate'][] = 'farm_livestock_birth_log_form_validate';
}