function xmlsitemap_term_form_alter in XML sitemap 5
Same name and namespace in other branches
- 5.2 xmlsitemap_term/xmlsitemap_term.module \xmlsitemap_term_form_alter()
Implementation of hook_form_alter().
Related topics
File
- xmlsitemap_term/
xmlsitemap_term.module, line 137 - Adds terms to the site map.
Code
function xmlsitemap_term_form_alter($form_id, &$form) {
switch ($form_id) {
case 'taxonomy_form_term':
$priority = db_result(db_query("SELECT priority_override FROM {xmlsitemap_term} WHERE tid = %d", $form['tid']['#value']));
$priority = isset($priority) ? $priority : 'NULL';
if (user_access('override term priority')) {
$options = xmlsitemap_priority_options('both');
$default = variable_get('xmlsitemap_term_vocabulary_priority_' . $form['vid']['#value'], '0.5');
$form['xmlsitemap_term_priority'] = array(
'#type' => 'select',
'#title' => t('Site map priority'),
'#default_value' => $priority,
'#options' => $options,
'#description' => t('The default priority is %priority.', array(
'%priority' => $options[$default],
)),
);
$form['submit']['#weight'] = 1;
$form['delete']['#weight'] = 1;
}
else {
$form['xmlsitemap_term_priority'] = array(
'#type' => 'value',
'#value' => $priority,
);
}
break;
case 'taxonomy_form_vocabulary':
$form['xmlsitemap_term_vocabulary_priority'] = array(
'#type' => 'select',
'#title' => t('Site map priority'),
'#default_value' => variable_get('xmlsitemap_term_vocabulary_priority_' . $form['vid']['#value'], 0.5),
'#options' => xmlsitemap_priority_options('exclude'),
'#description' => t('This will be the default priority of terms in this vocabulary.'),
);
$form['submit']['#weight'] = 1;
$form['delete']['#weight'] = 1;
break;
}
}