function HelpTopicPluginManager::findDefinitions
Same name in other branches
- 9 core/modules/help_topics/src/HelpTopicPluginManager.php \Drupal\help_topics\HelpTopicPluginManager::findDefinitions()
- 8.9.x core/modules/help_topics/src/HelpTopicPluginManager.php \Drupal\help_topics\HelpTopicPluginManager::findDefinitions()
- 11.x core/modules/help/src/HelpTopicPluginManager.php \Drupal\help\HelpTopicPluginManager::findDefinitions()
Overrides DefaultPluginManager::findDefinitions
File
-
core/
modules/ help/ src/ HelpTopicPluginManager.php, line 144
Class
- HelpTopicPluginManager
- Provides the default help_topic manager.
Namespace
Drupal\helpCode
protected function findDefinitions() {
$definitions = parent::findDefinitions();
// At this point the plugin list only contains valid plugins. Ensure all
// related plugins exist and the relationship is bi-directional. This
// ensures topics are listed on their related topics.
foreach ($definitions as $plugin_id => $plugin_definition) {
foreach ($plugin_definition['related'] as $key => $related_id) {
// If the related help topic does not exist it might be for a module
// that is not installed. Remove it.
// @todo Discuss this more as this could cause silent errors but it
// offers useful functionality to relate to a help topic provided by
// extensions that are yet to be installed.
// https://www.drupal.org/i/3360133
if (!isset($definitions[$related_id])) {
unset($definitions[$plugin_id]['related'][$key]);
continue;
}
// Make the related relationship bi-directional.
if (isset($definitions[$related_id]) && !in_array($plugin_id, $definitions[$related_id]['related'], TRUE)) {
$definitions[$related_id]['related'][] = $plugin_id;
}
}
}
return $definitions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.