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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
dd60468d
Commit
dd60468d
authored
Nov 2, 2012
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1828414
by tim.plunkett: Fixed Allow Views to be deleted.
parent
6b17f09e
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php
+9
-0
9 additions, 0 deletions
...ules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php
core/modules/views/views_ui/views_ui.module
+34
-0
34 additions, 0 deletions
core/modules/views/views_ui/views_ui.module
with
43 additions
and
0 deletions
core/modules/views/lib/Drupal/views/Tests/UI/DefaultViewsTest.php
+
9
−
0
View file @
dd60468d
...
@@ -87,6 +87,15 @@ function testDefaultViews() {
...
@@ -87,6 +87,15 @@ function testDefaultViews() {
$this
->
clickViewsOperationLink
(
t
(
'Enable'
),
'/frontpage/'
);
$this
->
clickViewsOperationLink
(
t
(
'Enable'
),
'/frontpage/'
);
$this
->
assertUrl
(
'admin/structure/views'
);
$this
->
assertUrl
(
'admin/structure/views'
);
$this
->
assertLinkByHref
(
$edit_href
);
$this
->
assertLinkByHref
(
$edit_href
);
// Test deleting a view.
$this
->
drupalGet
(
'admin/structure/views'
);
$this
->
clickViewsOperationLink
(
t
(
'Delete'
),
'/frontpage/'
);
// Submit the confirmation form.
$this
->
drupalPost
(
NULL
,
array
(),
t
(
'Delete'
));
// Ensure the view is no longer listed.
$this
->
assertUrl
(
'admin/structure/views'
);
$this
->
assertNoLinkByHref
(
$edit_href
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
core/modules/views/views_ui/views_ui.module
+
34
−
0
View file @
dd60468d
...
@@ -57,6 +57,13 @@ function views_ui_menu() {
...
@@ -57,6 +57,13 @@ function views_ui_menu() {
'title'
=>
'Disable a view'
,
'title'
=>
'Disable a view'
,
)
+
$ajax_base
;
)
+
$ajax_base
;
$items
[
'admin/structure/views/view/%views_ui/delete'
]
=
array
(
'title'
=>
'Delete a view'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'views_ui_confirm_delete'
,
4
),
'type'
=>
MENU_CALLBACK
,
)
+
$base
;
$items
[
'admin/structure/views/settings'
]
=
array
(
$items
[
'admin/structure/views/settings'
]
=
array
(
'title'
=>
'Settings'
,
'title'
=>
'Settings'
,
'page callback'
=>
'drupal_get_form'
,
'page callback'
=>
'drupal_get_form'
,
...
@@ -752,6 +759,33 @@ function views_ui_ajax_callback(ViewExecutable $view, $op) {
...
@@ -752,6 +759,33 @@ function views_ui_ajax_callback(ViewExecutable $view, $op) {
}
}
}
}
/**
* Form constructor for the View deletion form.
*
* @param \Drupal\views\ViewExectuable $view
* The View being deleted.
*
* @see views_ui_confirm_delete_submit()
*/
function
views_ui_confirm_delete
(
$form
,
&
$form_state
,
ViewExecutable
$view
)
{
$form
[
'view'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$view
);
return
confirm_form
(
$form
,
t
(
'Are you sure you want to delete the %name view?'
,
array
(
'%name'
=>
$view
->
storage
->
getHumanName
())),
'admin/structure/views'
,
t
(
'This action cannot be undone.'
),
t
(
'Delete'
),
t
(
'Cancel'
)
);
}
/**
* Form submission handler for views_ui_confirm_delete().
*/
function
views_ui_confirm_delete_submit
(
$form
,
&
$form_state
)
{
$form_state
[
'values'
][
'view'
]
->
storage
->
delete
();
$form_state
[
'redirect'
]
=
'admin/structure/views'
;
}
/**
/**
* Page callback: Lists all of the views.
* Page callback: Lists all of the views.
*
*
...
...
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