You are here

public function ContextualLinkManager::getContextualLinkPluginsByGroup in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Menu/ContextualLinkManager.php \Drupal\Core\Menu\ContextualLinkManager::getContextualLinkPluginsByGroup()

Gets the contextual link plugins by contextual link group.

Parameters

string $group_name: The group name.

Return value

array A list of contextual links plugin definitions.

Overrides ContextualLinkManagerInterface::getContextualLinkPluginsByGroup

1 call to ContextualLinkManager::getContextualLinkPluginsByGroup()
ContextualLinkManager::getContextualLinksArrayByGroup in core/lib/Drupal/Core/Menu/ContextualLinkManager.php
Gets the contextual links prepared as expected by links.html.twig.

File

core/lib/Drupal/Core/Menu/ContextualLinkManager.php, line 147
Contains \Drupal\Core\Menu\ContextualLinkManager.

Class

ContextualLinkManager
Defines a contextual link plugin manager to deal with contextual links.

Namespace

Drupal\Core\Menu

Code

public function getContextualLinkPluginsByGroup($group_name) {
  if (isset($this->pluginsByGroup[$group_name])) {
    $contextual_links = $this->pluginsByGroup[$group_name];
  }
  elseif ($cache = $this->cacheBackend
    ->get($this->cacheKey . ':' . $group_name)) {
    $contextual_links = $cache->data;
    $this->pluginsByGroup[$group_name] = $contextual_links;
  }
  else {
    $contextual_links = array();
    foreach ($this
      ->getDefinitions() as $plugin_id => $plugin_definition) {
      if ($plugin_definition['group'] == $group_name) {
        $contextual_links[$plugin_id] = $plugin_definition;
      }
    }
    $this->cacheBackend
      ->set($this->cacheKey . ':' . $group_name, $contextual_links);
    $this->pluginsByGroup[$group_name] = $contextual_links;
  }
  return $contextual_links;
}