HelpSectionManager.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Drupal\help;
  3. use Drupal\Core\Cache\CacheBackendInterface;
  4. use Drupal\Core\Extension\ModuleHandlerInterface;
  5. use Drupal\Core\Plugin\DefaultPluginManager;
  6. /**
  7. * Manages help page section plugins.
  8. *
  9. * @see \Drupal\help\HelpSectionPluginInterface
  10. * @see \Drupal\help\Plugin\HelpSection\HelpSectionPluginBase
  11. * @see \Drupal\help\Annotation\HelpSection
  12. * @see hook_help_section_info_alter()
  13. */
  14. class HelpSectionManager extends DefaultPluginManager {
  15. /**
  16. * Constructs a new HelpSectionManager.
  17. *
  18. * @param \Traversable $namespaces
  19. * An object that implements \Traversable which contains the root paths
  20. * keyed by the corresponding namespace to look for plugin implementations.
  21. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
  22. * Cache backend instance to use.
  23. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
  24. * The module handler for the alter hook.
  25. */
  26. public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
  27. parent::__construct('Plugin/HelpSection', $namespaces, $module_handler, 'Drupal\help\HelpSectionPluginInterface', 'Drupal\help\Annotation\HelpSection');
  28. $this->alterInfo('help_section_info');
  29. $this->setCacheBackend($cache_backend, 'help_section_plugins');
  30. }
  31. }