function library_autocomplete_input in Library 5.2
Same name and namespace in other branches
- 6.2 library.module \library_autocomplete_input()
- 6 library.module \library_autocomplete_input()
- 7 library.module \library_autocomplete_input()
1 call to library_autocomplete_input()
File
- ./
library.module, line 1284
Code
function library_autocomplete_input($item = NULL) {
if (variable_get('library_item_barcodes', LIBRARY_NO_BARCODES) == LIBRARY_BARCODES) {
$form['item_id'] = array(
'#type' => 'textfield',
'#title' => t('Item Barcode'),
'#default_value' => $item ? $item->barcode . ' [title:' . $item->title . '] [id:' . $item->id . ']' : '',
'#autocomplete_path' => 'library-items/autocomplete',
'#required' => TRUE,
'#description' => t('Enter the barcode and then select the item from the provided list.'),
);
}
else {
$my_default_value = $item ? $item->title : '';
$my_default_value .= !empty($item->version) ? ' ' . $item->version : '';
$my_default_value .= $item ? ' [id:' . $item->id . ']' : '';
$form['item_id'] = array(
'#type' => 'textfield',
'#title' => t('Library Item'),
'#default_value' => $my_default_value,
'#autocomplete_path' => 'library-items/autocomplete',
'#required' => TRUE,
'#description' => t('Begin typing the title of the item, then select the chosen item from the provided list.'),
);
}
return $form;
}