Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
4c135457
Commit
4c135457
authored
19 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#41474
by spiderman: no confirmation when deleting a path alias.
parent
4f13fbb7
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/path.module
+30
-3
30 additions, 3 deletions
modules/path.module
modules/path/path.module
+30
-3
30 additions, 3 deletions
modules/path/path.module
with
60 additions
and
6 deletions
modules/path.module
+
30
−
3
View file @
4c135457
...
...
@@ -58,7 +58,7 @@ function path_menu($may_cache) {
'access'
=>
user_access
(
'administer url aliases'
),
'type'
=>
MENU_CALLBACK
);
$items
[]
=
array
(
'path'
=>
'admin/path/delete'
,
'title'
=>
t
(
'delete alias'
),
'callback'
=>
'path_admin_delete'
,
'callback'
=>
'path_admin_delete
_confirm
'
,
'access'
=>
user_access
(
'administer url aliases'
),
'type'
=>
MENU_CALLBACK
);
$items
[]
=
array
(
'path'
=>
'admin/path/list'
,
'title'
=>
t
(
'list'
),
...
...
@@ -96,14 +96,41 @@ function path_admin_edit($pid = 0) {
}
/**
* Menu callback; handles deletion of an URL alias.
* Menu callback; confirms deleting an URL alias
**/
function
path_admin_delete_confirm
(
$pid
)
{
$path
=
path_load
(
$pid
);
if
(
user_access
(
'administer path aliases'
))
{
$form
[
'pid'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$pid
);
$output
=
confirm_form
(
'path_admin_delete_confirm'
,
$form
,
t
(
'Are you sure you want to delete path alias %title?'
,
array
(
'%title'
=>
theme
(
'placeholder'
,
$path
[
'dst'
]))),
$_GET
[
'destination'
]
?
$_GET
[
'destination'
]
:
'admin/path'
,
t
(
'This action cannot be undone.'
),
t
(
'Delete'
),
t
(
'Cancel'
)
);
}
return
$output
;
}
/**
* Execute URL alias deletion
**/
function
path_admin_delete_confirm_submit
(
$form_id
,
$form_values
)
{
if
(
$form_values
[
'confirm'
])
{
path_admin_delete
(
$form_values
[
'pid'
]);
drupal_goto
(
'admin/path'
);
}
}
/**
* Post-confirmation; delete an URL alias.
*/
function
path_admin_delete
(
$pid
=
0
)
{
db_query
(
'DELETE FROM {url_alias} WHERE pid = %d'
,
$pid
);
drupal_set_message
(
t
(
'The alias has been deleted.'
));
drupal_goto
(
'admin/path'
);
}
/**
* Set an aliased path for a given Drupal path, preventing duplicates.
*/
...
...
This diff is collapsed.
Click to expand it.
modules/path/path.module
+
30
−
3
View file @
4c135457
...
...
@@ -58,7 +58,7 @@ function path_menu($may_cache) {
'access'
=>
user_access
(
'administer url aliases'
),
'type'
=>
MENU_CALLBACK
);
$items
[]
=
array
(
'path'
=>
'admin/path/delete'
,
'title'
=>
t
(
'delete alias'
),
'callback'
=>
'path_admin_delete'
,
'callback'
=>
'path_admin_delete
_confirm
'
,
'access'
=>
user_access
(
'administer url aliases'
),
'type'
=>
MENU_CALLBACK
);
$items
[]
=
array
(
'path'
=>
'admin/path/list'
,
'title'
=>
t
(
'list'
),
...
...
@@ -96,14 +96,41 @@ function path_admin_edit($pid = 0) {
}
/**
* Menu callback; handles deletion of an URL alias.
* Menu callback; confirms deleting an URL alias
**/
function
path_admin_delete_confirm
(
$pid
)
{
$path
=
path_load
(
$pid
);
if
(
user_access
(
'administer path aliases'
))
{
$form
[
'pid'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$pid
);
$output
=
confirm_form
(
'path_admin_delete_confirm'
,
$form
,
t
(
'Are you sure you want to delete path alias %title?'
,
array
(
'%title'
=>
theme
(
'placeholder'
,
$path
[
'dst'
]))),
$_GET
[
'destination'
]
?
$_GET
[
'destination'
]
:
'admin/path'
,
t
(
'This action cannot be undone.'
),
t
(
'Delete'
),
t
(
'Cancel'
)
);
}
return
$output
;
}
/**
* Execute URL alias deletion
**/
function
path_admin_delete_confirm_submit
(
$form_id
,
$form_values
)
{
if
(
$form_values
[
'confirm'
])
{
path_admin_delete
(
$form_values
[
'pid'
]);
drupal_goto
(
'admin/path'
);
}
}
/**
* Post-confirmation; delete an URL alias.
*/
function
path_admin_delete
(
$pid
=
0
)
{
db_query
(
'DELETE FROM {url_alias} WHERE pid = %d'
,
$pid
);
drupal_set_message
(
t
(
'The alias has been deleted.'
));
drupal_goto
(
'admin/path'
);
}
/**
* Set an aliased path for a given Drupal path, preventing duplicates.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment