function quotes_author_form in Quotes 5
Same name and namespace in other branches
- 6 quotes.module \quotes_author_form()
- 7 quotes.module \quotes_author_form()
Form to select an author.
1 string reference to 'quotes_author_form'
- quotes_author in ./
quotes.module - Menu callback that selects quotes based on author.
File
- ./
quotes.module, line 1457
Code
function quotes_author_form() {
$form = array();
$max_name_length = 78;
$authors = quotes_get_authors();
$author_names = array();
foreach ($authors as $aid => $name) {
// Make it safe to display (with no HTML).
$name = filter_xss($name, array());
// Limit the length.
if (drupal_strlen($name) > $max_name_length) {
$name = drupal_substr($name, 0, $max_name_length - 3) . '...';
}
$author_names[$aid] = $name;
}
$form['author'] = array(
'#type' => 'select',
'#options' => $author_names,
'#size' => min(25, count($authors)),
'#description' => t('Select an author from the list.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Select'),
);
return $form;
}