1.20.x path.module | path_pattern_settings_form($settings) |
Return the URL alias pattern settings form for easy addition into other forms.
Parameters
$settings: Array of variables needed to complete the form, including: default: Default value for URL alias pattern field. description: Description for the Default URL alias pattern field. token_types: Array of token types available.
Return value
$form: The complete form with path pattern settings fields added.
File
- modules/
path/ path.module, line 388 - Enables users to customize URLs and provide automatic URL alias patterns.
Code
function path_pattern_settings_form($settings) {
$form['path'] = array(
'#type' => 'fieldset',
'#title' => t('URL alias pattern'),
'#group' => 'additional_settings',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#access' => user_access('administer path patterns'),
);
$form['path']['path_pattern'] = array(
'#type' => 'textfield',
'#title' => t('Default URL alias pattern'),
'#default_value' => $settings['default'],
'#description' => $settings['description'],
'#maxlength' => 1280,
'#element_validate' => array('token_element_validate'),
'#after_build' => array('token_element_validate'),
'#token_types' => $settings['token_types'],
'#min_tokens' => 1,
);
$form['path']['path_tokens'] = array(
'#theme' => 'token_tree_link',
'#token_types' => $settings['token_types'],
'#global_types' => FALSE,
'#click_insert' => TRUE,
);
return $form;
}