Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f007e491
Commit
f007e491
authored
Dec 30, 2014
by
catch
Browse files
Issue
#2373017
by olli: No delete link when editing a menu, only reset links
parent
b778bfd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Menu/MenuLinkBase.php
View file @
f007e491
...
...
@@ -9,7 +9,6 @@
use
Drupal\Component\Plugin\Exception\PluginException
;
use
Drupal\Component\Utility\String
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Plugin\PluginBase
;
use
Drupal\Core\Url
;
...
...
@@ -77,7 +76,7 @@ public function isExpanded() {
* {@inheritdoc}
*/
public
function
isResettable
()
{
return
AccessResult
::
forbidden
()
;
return
FALSE
;
}
/**
...
...
core/lib/Drupal/Core/Menu/MenuLinkDefault.php
View file @
f007e491
...
...
@@ -7,7 +7,6 @@
namespace
Drupal\Core\Menu
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -95,8 +94,7 @@ public function getDescription() {
*/
public
function
isResettable
()
{
// The link can be reset if it has an override.
// @todo This will be cacheable after https://www.drupal.org/node/2040135.
return
AccessResult
::
allowedIf
(
$this
->
staticOverride
->
loadOverride
(
$this
->
getPluginId
()))
->
setCacheable
(
FALSE
);
return
(
bool
)
$this
->
staticOverride
->
loadOverride
(
$this
->
getPluginId
());
}
/**
...
...
core/modules/menu_ui/src/MenuForm.php
View file @
f007e491
...
...
@@ -397,7 +397,7 @@ protected function buildOverviewTreeForm($tree, $delta) {
);
}
elseif
(
$delete_link
=
$link
->
getDeleteRoute
())
{
$operations
[
'delete'
]
=
$delete_link
;
$operations
[
'delete'
]
[
'url'
]
=
$delete_link
;
$operations
[
'delete'
][
'query'
][
'destination'
]
=
$this
->
entity
->
url
();
$operations
[
'delete'
][
'title'
]
=
$this
->
t
(
'Delete'
);
}
...
...
core/modules/menu_ui/src/Tests/MenuTest.php
View file @
f007e491
...
...
@@ -11,6 +11,7 @@
use
Drupal\Component\Utility\Unicode
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Menu\MenuLinkInterface
;
use
Drupal\Core\Url
;
use
Drupal\menu_link_content
\
Entity\MenuLinkContent
;
use
Drupal\system\Entity\Menu
;
use
Drupal\node\Entity\Node
;
...
...
@@ -103,6 +104,16 @@ function testMenu() {
// Login the administrator.
$this
->
drupalLogin
(
$this
->
admin_user
);
// Verify delete link exists and reset link does not exist.
$this
->
drupalGet
(
'admin/structure/menu/manage/'
.
$this
->
menu
->
id
());
$this
->
assertLinkByHref
(
'admin/structure/menu/item/'
.
$this
->
items
[
0
]
->
id
()
.
'/delete'
);
$this
->
assertNoLinkByHref
(
Url
::
fromUri
(
'base://admin/structure/menu/link/'
.
$this
->
items
[
0
]
->
getPluginId
()
.
'/reset'
)
->
toString
());
// Check delete and reset access.
$this
->
drupalGet
(
'admin/structure/menu/item/'
.
$this
->
items
[
0
]
->
id
()
.
'/delete'
);
$this
->
assertResponse
(
200
);
$this
->
drupalGet
(
'admin/structure/menu/link/'
.
$this
->
items
[
0
]
->
getPluginId
()
.
'/reset'
);
$this
->
assertResponse
(
403
);
// Delete menu links.
foreach
(
$this
->
items
as
$item
)
{
$this
->
deleteMenuLink
(
$item
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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