public ContextualLinkManager::getContextualLinksArrayByGroup($group_name, array $route_parameters, array $metadata = array())
Gets the contextual links prepared as expected by links.html.twig.
string $group_name: The group name.
array $route_parameters: The incoming route parameters. The route parameters need to have the same name on all contextual link routes, e.g. you cannot use 'node' and 'entity' in parallel.
array $metadata: Additional metadata of contextual links, like the position (optional).
array An array of link information, keyed by the plugin ID. Each entry is an associative array with the following keys:
Overrides ContextualLinkManagerInterface::getContextualLinksArrayByGroup
public function getContextualLinksArrayByGroup($group_name, array $route_parameters, array $metadata = array()) { $links = array(); $request = $this->requestStack->getCurrentRequest(); foreach ($this->getContextualLinkPluginsByGroup($group_name) as $plugin_id => $plugin_definition) { /** @var $plugin \Drupal\Core\Menu\ContextualLinkInterface */ $plugin = $this->createInstance($plugin_id); $route_name = $plugin->getRouteName(); // Check access. if (!$this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account)) { continue; } $links[$plugin_id] = array( 'route_name' => $route_name, 'route_parameters' => $route_parameters, 'title' => $plugin->getTitle($request), 'weight' => $plugin->getWeight(), 'localized_options' => $plugin->getOptions(), 'metadata' => $metadata, ); } $this->moduleHandler->alter('contextual_links', $links, $group_name, $route_parameters); return $links; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!ContextualLinkManager.php/function/ContextualLinkManager::getContextualLinksArrayByGroup/8.1.x