You are here

public function HelpTopicDiscovery::getDefinitions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/help_topics/src/HelpTopicDiscovery.php \Drupal\help_topics\HelpTopicDiscovery::getDefinitions()
  2. 9 core/modules/help_topics/src/HelpTopicDiscovery.php \Drupal\help_topics\HelpTopicDiscovery::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DiscoveryTrait::getDefinitions

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

File

core/modules/help_topics/src/HelpTopicDiscovery.php, line 60

Class

HelpTopicDiscovery
Discovers help topic plugins from Twig files in help_topics directories.

Namespace

Drupal\help_topics

Code

public function getDefinitions() {
  $plugins = $this
    ->findAll();

  // Flatten definitions into what's expected from plugins.
  $definitions = [];
  foreach ($plugins as $list) {
    foreach ($list as $id => $definition) {
      $definitions[$id] = $definition;
    }
  }
  return $definitions;
}