function quotes_bios in Quotes 6
Same name and namespace in other branches
- 5 quotes.module \quotes_bios()
- 7 quotes.admin.inc \quotes_bios()
Bios maintenance page.
Return value
A form with a tab-delimited list of quotes.
1 string reference to 'quotes_bios'
- quotes_menu in ./
quotes.module - Implementation of hook_menu().
File
- ./
quotes.admin.inc, line 421 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_bios(&$form_state, $aid = NULL) {
$form = array();
$first_pass = is_null($aid);
if ($first_pass) {
$auths = quotes_get_authors();
$count = count($auths);
$data = array(
'name' => NULL,
'bio' => NULL,
);
}
else {
// Get the data.
$data = db_fetch_array(db_query("SELECT * FROM {quotes_authors} WHERE aid=%d", $aid));
}
$form['aid'] = array(
'#type' => 'hidden',
'#value' => $aid,
);
$form['author'] = array(
'#type' => 'select',
'#options' => $auths,
'#size' => min(20, $count),
'#description' => t('Pick the author whose biography you wish to update.'),
);
$form['name'] = array(
'#type' => 'markup',
'#value' => '<h3>' . t('Biography for %name', array(
'%name' => $data['name'],
)) . '</h3>',
);
$form['bio'] = array(
'#type' => 'textarea',
'#description' => t("This is the author's biography."),
'#default_value' => $data['bio'],
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => $first_pass ? t('Get biography') : t('Update'),
);
// Show the fields at the right time.
if ($first_pass) {
$form['name']['#type'] = 'hidden';
$form['bio']['#type'] = 'hidden';
}
else {
$form['author']['#type'] = 'hidden';
}
return $form;
}