1 path.module | path_form_taxonomy_form_vocabulary_alter(&$form, $form_state) |
Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary().
File
- core/
modules/ path/ path.module, line 307 - Enables users to customize URLs and provide automatic URL alias patterns.
Code
function path_form_taxonomy_form_vocabulary_alter(&$form, $form_state) {
$path_settings_config = config('path.settings');
$url_pattern = $path_settings_config->get('taxonomy_term_pattern');
if (isset($form['#vocabulary']->machine_name)) {
$specific_url_pattern = $path_settings_config->get('taxonomy_term_' . $form['#vocabulary']->machine_name . '_pattern');
if ($specific_url_pattern != NULL) {
$url_pattern = $specific_url_pattern;
}
}
$settings = array(
'default' => $url_pattern,
'description' => t('New pages will have URLs that match a pattern based on wildcards called <em>tokens</em>. For example the URL <code>tags/environment</code> could be created using the pattern <code>[term:vocabulary]/[term:name]</code> if the vocabulary is named "Tags" and the term is named "Environment".'),
'token_types' => array('vocabulary', 'term'),
);
$form += path_pattern_settings_form($settings);
$form['#submit'][] = 'path_taxonomy_form_vocabulary_submit';
}