function farm_log_prepopulate_log_form_name in farmOS 7
Helper function for populating the name field in log forms.
Parameters
array $form: The form array to modify, passed by reference.
1 call to farm_log_prepopulate_log_form_name()
- farm_log_form_log_form_alter in modules/
farm/ farm_log/ farm_log.module - Implements hook_form_FORM_ID_alter().
File
- modules/
farm/ farm_log/ farm_log.module, line 471 - Code for the Farm Log feature.
Code
function farm_log_prepopulate_log_form_name(&$form) {
// If the GET parameter isn't set, bail.
$params = drupal_get_query_parameters();
if (empty($params['name'])) {
return;
}
// If the log form name field already has a default value, bail.
if (!empty($form['name']['#default_value'])) {
return;
}
// Set the name in the form.
$form['name']['#default_value'] = $params['name'];
}