Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
229
Merge Requests
229
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
3c12e215
Commit
3c12e215
authored
Jul 28, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2498785
by damiankloip, dawehner: Remove ViewExecutable::getMenuLinks(), its just wrong
parent
999332b6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
54 deletions
+50
-54
core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php
core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php
+4
-1
core/modules/views/src/Plugin/views/display/DisplayMenuInterface.php
...s/views/src/Plugin/views/display/DisplayMenuInterface.php
+25
-0
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
...ules/views/src/Plugin/views/display/DisplayPluginBase.php
+7
-19
core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php
...views/src/Plugin/views/display/DisplayPluginInterface.php
+0
-10
core/modules/views/src/Plugin/views/display/DisplayRouterInterface.php
...views/src/Plugin/views/display/DisplayRouterInterface.php
+1
-0
core/modules/views/src/Plugin/views/display/PathPluginBase.php
...modules/views/src/Plugin/views/display/PathPluginBase.php
+13
-1
core/modules/views/src/ViewExecutable.php
core/modules/views/src/ViewExecutable.php
+0
-23
No files found.
core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php
View file @
3c12e215
...
...
@@ -9,6 +9,7 @@
use
Drupal\Component\Plugin\Derivative\DeriverBase
;
use
Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
;
use
Drupal\views\Plugin\views\display\DisplayMenuInterface
;
use
Drupal\views\Views
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -57,8 +58,10 @@ public function getDerivativeDefinitions($base_plugin_definition) {
list
(
$view_id
,
$display_id
)
=
$data
;
/** @var \Drupal\views\ViewExecutable $executable */
$executable
=
$this
->
viewStorage
->
load
(
$view_id
)
->
getExecutable
();
$executable
->
initDisplay
();
$display
=
$executable
->
displayHandlers
->
get
(
$display_id
);
if
(
$result
=
$executable
->
getMenuLinks
(
$display_id
))
{
if
(
(
$display
instanceof
DisplayMenuInterface
)
&&
(
$result
=
$display
->
getMenuLinks
()
))
{
foreach
(
$result
as
$link_id
=>
$link
)
{
$links
[
$link_id
]
=
$link
+
$base_plugin_definition
;
}
...
...
core/modules/views/src/Plugin/views/display/DisplayMenuInterface.php
0 → 100644
View file @
3c12e215
<?php
/**
* @file
* Contains \Drupal\views\Plugin\views\display\DisplayMenuInterface.
*/
namespace
Drupal\views\Plugin\views\display
;
/**
* Defines an interface for displays that provide menu links.
*/
interface
DisplayMenuInterface
{
/**
* Gets menu links, if this display provides some.
*
* @return array
* The menu links registers for this display.
*
* @see \Drupal\views\Plugin\Derivative\ViewsMenuLink
*/
public
function
getMenuLinks
();
}
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
View file @
3c12e215
...
...
@@ -2112,13 +2112,6 @@ public function renderMoreLink() {
}
}
/**
* {@inheritdoc}
*/
public
function
getMenuLinks
()
{
return
array
();
}
/**
* {@inheritdoc}
*/
...
...
@@ -2472,18 +2465,6 @@ public function validate() {
public
function
newDisplay
()
{
}
/**
* {@inheritdoc}
*/
public
function
remove
()
{
$menu_links
=
$this
->
getMenuLinks
();
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager
=
\
Drupal
::
service
(
'plugin.manager.menu.link'
);
foreach
(
$menu_links
as
$menu_link_id
=>
$menu_link
)
{
$menu_link_manager
->
removeDefinition
(
"views_view:
$menu_link_id
"
);
}
}
/**
* {@inheritdoc}
*/
...
...
@@ -2611,6 +2592,13 @@ public function mergeDefaults() {
}
}
/**
* {@inheritdoc}
*/
public
function
remove
()
{
}
/**
* Merges plugins default values.
*
...
...
core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php
View file @
3c12e215
...
...
@@ -381,16 +381,6 @@ public function renderPager();
*/
public
function
renderMoreLink
();
/**
* Gets menu links, if this display provides some.
*
* @return array
* The menu links registers for this display.
*
* @see \Drupal\views\Plugin\Derivative\ViewsMenuLink
*/
public
function
getMenuLinks
();
/**
* Renders this display.
*/
...
...
core/modules/views/src/Plugin/views/display/DisplayRouterInterface.php
View file @
3c12e215
...
...
@@ -71,4 +71,5 @@ public function getRouteName();
* @see \Drupal\views\Plugin\views\display\DisplayRouterInterface::alterRoutes()
*/
public
function
getAlteredRouteNames
();
}
core/modules/views/src/Plugin/views/display/PathPluginBase.php
View file @
3c12e215
...
...
@@ -29,7 +29,7 @@
*
* @see \Drupal\views\EventSubscriber\RouteSubscriber
*/
abstract
class
PathPluginBase
extends
DisplayPluginBase
implements
DisplayRouterInterface
{
abstract
class
PathPluginBase
extends
DisplayPluginBase
implements
DisplayRouterInterface
,
DisplayMenuInterface
{
use
UrlGeneratorTrait
;
...
...
@@ -521,4 +521,16 @@ public function getAlteredRouteNames() {
return
$this
->
state
->
get
(
'views.view_route_names'
)
?:
array
();
}
/**
* {@inheritdoc}
*/
public
function
remove
()
{
$menu_links
=
$this
->
getMenuLinks
();
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager
=
\
Drupal
::
service
(
'plugin.manager.menu.link'
);
foreach
(
$menu_links
as
$menu_link_id
=>
$menu_link
)
{
$menu_link_manager
->
removeDefinition
(
"views_view:
$menu_link_id
"
);
}
}
}
core/modules/views/src/ViewExecutable.php
View file @
3c12e215
...
...
@@ -1615,29 +1615,6 @@ public function attachDisplays() {
$this
->
is_attachment
=
FALSE
;
}
/**
* Returns menu links from the view and the named display handler.
*
* @param string $display_id
* A display ID.
*
* @return array|bool
* The generated menu links for this view and display, FALSE if the call
* to ::setDisplay failed.
*/
public
function
getMenuLinks
(
$display_id
=
NULL
)
{
// Prepare the view with the information we have. This was probably already
// called, but it's good to be safe.
if
(
!
$this
->
setDisplay
(
$display_id
))
{
return
FALSE
;
}
// Execute the hook.
if
(
isset
(
$this
->
display_handler
))
{
return
$this
->
display_handler
->
getMenuLinks
();
}
}
/**
* Determine if the given user has access to the view. Note that
* this sets the display handler if it hasn't been.
...
...
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