function xmlsitemap_node_form_alter in XML sitemap 6
Same name and namespace in other branches
- 5.2 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_form_alter()
- 5 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_form_alter()
- 6.2 xmlsitemap_node/xmlsitemap_node.module \xmlsitemap_node_form_alter()
Implementation of hook_form_alter().
File
- xmlsitemap_node/
xmlsitemap_node.module, line 102 - Adds nodes to the sitemap.
Code
function xmlsitemap_node_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['type']) && $form_id == $form['type']['#value'] . '_node_form') {
$node = $form['#node'];
if (!isset($form['xmlsitemap'])) {
$form['xmlsitemap'] = array(
'#type' => 'fieldset',
'#title' => t('XML sitemap'),
'#collapsible' => TRUE,
'#access' => user_access('override node settings') || user_access('administer nodes'),
'#weight' => 30,
);
}
$options = xmlsitemap_priority_options('both');
$default = variable_get('xmlsitemap_node_type_priority_' . $node->type, '0.5');
$form['xmlsitemap']['priority_override'] = array(
'#type' => 'select',
'#title' => t('Priority'),
'#description' => t('The default priority is %priority.', array(
'%priority' => $options[$default],
)),
'#default_value' => isset($node->priority_override) ? $node->priority_override : -2.0,
'#options' => $options,
'#access' => user_access('override node settings') || user_access('administer nodes'),
);
}
}