Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f048b4a1
Commit
f048b4a1
authored
Dec 16, 2013
by
Alex Pott
Browse files
Issue
#2156351
by olli: Unable to delete block.
parent
5fc0ca81
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/block/lib/Drupal/block/BlockFormController.php
View file @
f048b4a1
...
...
@@ -350,6 +350,11 @@ public function delete(array $form, array &$form_state) {
'block'
=>
$this
->
entity
->
id
(),
),
);
$query
=
$this
->
getRequest
()
->
query
;
if
(
$query
->
has
(
'destination'
))
{
$form_state
[
'redirect_route'
][
'options'
][
'query'
][
'destination'
]
=
$query
->
get
(
'destination'
);
$query
->
remove
(
'destination'
);
}
}
/**
...
...
core/modules/block/lib/Drupal/block/Tests/BlockTest.php
View file @
f048b4a1
...
...
@@ -141,6 +141,16 @@ function testBlock() {
$this
->
assertRaw
(
t
(
'Are you sure you want to delete the block %name?'
,
array
(
'%name'
=>
$block
[
'settings[label]'
])));
$this
->
drupalPostForm
(
NULL
,
array
(),
t
(
'Delete'
));
$this
->
assertRaw
(
t
(
'The block %name has been removed.'
,
array
(
'%name'
=>
$block
[
'settings[label]'
])));
// Test deleting a block via "Configure block" link.
$block
=
$this
->
drupalPlaceBlock
(
'system_powered_by_block'
);
$this
->
drupalGet
(
'admin/structure/block/manage/'
.
$block
->
id
(),
array
(
'query'
=>
array
(
'destination'
=>
'admin'
)));
$this
->
drupalPostForm
(
NULL
,
array
(),
t
(
'Delete'
));
$this
->
assertRaw
(
t
(
'Are you sure you want to delete the block %name?'
,
array
(
'%name'
=>
$block
->
label
())));
$this
->
drupalPostForm
(
NULL
,
array
(),
t
(
'Delete'
));
$this
->
assertRaw
(
t
(
'The block %name has been removed.'
,
array
(
'%name'
=>
$block
->
label
())));
$this
->
assertUrl
(
'admin'
);
$this
->
assertNoRaw
(
$block
->
id
());
}
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment