diff options
Diffstat (limited to 'modules/path/path.module')
-rw-r--r-- | modules/path/path.module | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/modules/path/path.module b/modules/path/path.module index 332287de2..9df498865 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -13,7 +13,7 @@ function path_help($path, $arg) { case 'admin/help#path': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Path module allows you to specify an alias, or custom URL, for any existing internal system path. Aliases should not be confused with URL redirects, which allow you to forward a changed or inactive URL to a new URL. In addition to making URLs more readable, aliases also help search engines index content more effectively. Multiple aliases may be used for a single internal system path. To automate the aliasing of paths, you can install the contributed module <a href="@pathauto">Pathauto</a>. For more information, see the online handbook entry for the <a href="@path">Path module</a>.', array('@path' => 'http://drupal.org/handbook/modules/path', '@pathauto' => 'http://drupal.org/project/pathauto')) . '</p>'; + $output .= '<p>' . t('The Path module allows you to specify an alias, or custom URL, for any existing internal system path. Aliases should not be confused with URL redirects, which allow you to forward a changed or inactive URL to a new URL. In addition to making URLs more readable, aliases also help search engines index content more effectively. Multiple aliases may be used for a single internal system path. To automate the aliasing of paths, you can install the contributed module <a href="@pathauto">Pathauto</a>. For more information, see the online handbook entry for the <a href="@path">Path module</a>.', array('@path' => 'http://drupal.org/documentation/modules/path', '@pathauto' => 'http://drupal.org/project/pathauto')) . '</p>'; $output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<dl>'; $output .= '<dt>' . t('Creating aliases') . '</dt>'; @@ -91,7 +91,9 @@ function path_menu() { } /** - * Implements hook_form_BASE_FORM_ID_alter(). + * Implements hook_form_BASE_FORM_ID_alter() for node_form(). + * + * @see path_form_element_validate() */ function path_form_node_form_alter(&$form, $form_state) { $path = array(); @@ -145,11 +147,13 @@ function path_form_node_form_alter(&$form, $form_state) { /** * Form element validation handler for URL alias form element. + * + * @see path_form_node_form_alter() */ function path_form_element_validate($element, &$form_state, $complete_form) { - if (!empty($form_state['values']['path']['alias'])) { - // Trim the submitted value. - $alias = trim($form_state['values']['path']['alias']); + // Trim the submitted value. + $alias = trim($form_state['values']['path']['alias']); + if (!empty($alias)) { form_set_value($element['alias'], $alias, $form_state); // Node language (Locale module) needs special care. Since the language of // the URL alias depends on the node language, and the node language can be @@ -173,7 +177,7 @@ function path_form_element_validate($element, &$form_state, $complete_form) { $query->addExpression('1'); $query->range(0, 1); if ($query->execute()->fetchField()) { - form_set_error('alias', t('The alias is already in use.')); + form_error($element, t('The alias is already in use.')); } } } @@ -225,7 +229,7 @@ function path_node_delete($node) { } /** - * Implements hook_form_FORM_ID_alter(). + * Implements hook_form_FORM_ID_alter() for taxonomy_form_term(). */ function path_form_taxonomy_form_term_alter(&$form, $form_state) { // Make sure this does not show up on the delete confirmation form. |