@@ -22,13 +22,31 @@ function path_help($path, $arg) {
$output.='<p>'.t('This module also provides user-defined mass URL aliasing capabilities, which is useful if you wish to uniformly use URLs different from the default. For example, you may want to have your URLs presented in a different language. Access to the Drupal source code on the web server is required to set up mass URL aliasing.').' </p>';
$output.='<p>'.t('For more information, see the online handbook entry for <a href="@path">Path module</a>.',array('@path'=>'http://drupal.org/handbook/modules/path/')).'</p>';
return$output;
case'admin/config/search/path':
return'<p>'.t("An alias defines a different name for an existing URL path - for example, the alias 'about' for the URL path 'node/1'. A URL path can have multiple aliases.").'</p>';
case'admin/config/search/path/add':
return'<p>'.t('Enter the path you wish to create the alias for, followed by the name of the new alias.').'</p>';
}
}
/**
* Implement hook_permission().
*/
functionpath_permission(){
returnarray(
'administer url aliases'=>array(
'title'=>t('Administer URL aliases'),
'description'=>t('Manage URL aliases across the entire website.'),
),
'create url aliases'=>array(
'title'=>t('Create URL aliases'),
'description'=>t('Manage URL aliases on content.'),
),
);
}
/**
* Implement hook_menu().
*/
...
...
@@ -75,26 +93,34 @@ function path_menu() {
/**
* Fetch a specific URL alias from the database.
*
* @param $criteria
* @param $conditions
* A string representing the source, a number representing the pid, or an
* array of criteria.
* array of query conditions.
*
* @return
* FALSE if no alias was found or an associative array containing the
'#description'=>t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
'#description'=>t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
);
if($path){
$form['path']['pid']=array(
'#type'=>'value',
'#value'=>$form['#node']->path['pid'],
);
}
}
// Delete all aliases associated with this node.
path_delete(array('source'=>'node/'.$node->nid));
}
/**
...
...
@@ -303,86 +312,78 @@ function path_form_alter(&$form, $form_state, $form_id) {
'#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."),
);
if($path){
// Populate with pid so we can update existing path entry instead of creating a new one.