2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
* Return a form for editing or creating an individual URL alias.
*/
functionpath_form($edit=''){
$form['#base']='path_form';
$form['src']=array('#type'=>'textfield','#title'=>t('Existing system path'),'#default_value'=>$edit['src'],'#maxlength'=>64,'#description'=>t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'));
$form['dst']=array('#type'=>'textfield','#default_value'=>$edit['dst'],'#maxlength'=>64,'#description'=>t('Specify an alternative path by which this data 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.'));
...
...
@@ -323,10 +324,9 @@ function path_load($pid) {
}
/**
* Verify that a new URL alias is valid, and save it to the database.
* Verify that a new URL alias is valid
*/
functionpath_form_submit(){
$edit=$GLOBALS['form_values'];
functionpath_form_validate($form_id,$edit){
$src=$edit['src'];
$dst=$edit['dst'];
$pid=$edit['pid'];
...
...
@@ -342,16 +342,14 @@ function path_form_submit() {
if(db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s'",$pid,$dst))){
form_set_error('dst',t('The alias %alias is already in use.',array('%alias'=>$dst)));
}
if(form_get_errors()){
returnpath_form($edit);
}
else{
path_set_alias($src,$dst,$pid);
drupal_set_message(t('The alias has been saved.'));