path_form_taxonomy_form_term_alter
- Versions
- 7
path_form_taxonomy_form_term_alter(&$form, $form_state)
Implements hook_form_FORM_ID_alter().
Code
modules/path/path.module, line 230
<?php
function path_form_taxonomy_form_term_alter(&$form, $form_state) {
// Make sure this does not show up on the delete confirmation form.
if (empty($form_state['confirm_delete'])) {
$path = (isset($form['#term']['tid']) ? path_load('taxonomy/term/' . $form['#term']['tid']) : array());
if ($path === FALSE) {
$path = array();
}
$path += array(
'pid' => NULL,
'source' => isset($form['#term']['tid']) ? 'taxonomy/term/' . $form['#term']['tid'] : NULL,
'alias' => '',
'language' => LANGUAGE_NONE,
);
$form['identification']['path'] = array(
'#access' => user_access('create url aliases') || user_access('administer url aliases'),
'#tree' => TRUE,
'#element_validate' => array('path_form_element_validate'),
);
$form['identification']['path']['alias'] = array(
'#type' => 'textfield',
'#title' => t('URL alias'),
'#default_value' => $path['alias'],
'#maxlength' => 255,
'#weight' => 0,
'#description' => t("Optionally specify an alternative URL by which this term can be accessed. Use a relative path and don't add a trailing slash or the URL alias won't work."),
);
$form['identification']['path']['pid'] = array('#type' => 'value', '#value' => $path['pid']);
$form['identification']['path']['source'] = array('#type' => 'value', '#value' => $path['source']);
$form['identification']['path']['language'] = array('#type' => 'value', '#value' => $path['language']);
}
}
?>Login or register to post comments 