Add a shortcut link to the birth quick form when adding a new birth log.

This commit is contained in:
Michael Stenta 2018-04-23 09:28:11 -04:00
parent 4b716cb268
commit 627fce2249
1 changed files with 12 additions and 0 deletions

View File

@ -464,6 +464,18 @@ function farm_livestock_asset_form_submit(array $form, array &$form_state) {
farm_livestock_weight_set($asset, $weight, $units);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function farm_livestock_form_log_form_alter(&$form, &$form_state, $form_id) {
// 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) && $form['log']['#value']->type == 'farm_birth') {
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'))));
}
}
/**
* Implements hook_action_info().
*/