1 path.module path_form_node_type_form_alter(&$form, $form_state)

Implements hook_form_FORM_ID_alter().

File

core/modules/path/path.module, line 246
Enables users to customize URLs and provide automatic URL alias patterns.

Code

function path_form_node_type_form_alter(&$form, $form_state) {
  $url_pattern = config_get('path.settings', 'node_pattern');
  if (!empty($form['type']['#default_value'])) {
    $type = $form['type']['#default_value'];
    $specific_url_pattern = config_get('path.settings', 'node_' . $type . '_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>blog/my-first-post</code> could be created using the pattern <code>blog/[node:title]</code> if the title of the blog post was "My first post".'),
    'token_types' => array('node'),
  );
  $form += path_pattern_settings_form($settings);
  $form['#submit'][] = 'path_node_type_form_submit';
}