LinkRelationType::class, ]; /** * The app root. * * @var string */ protected $root; /** * Constructs a new LinkRelationTypeManager. * * @param string $root * The app root. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend. */ public function __construct($root, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache) { $this->root = $root; $this->pluginInterface = LinkRelationTypeInterface::class; $this->moduleHandler = $module_handler; $this->setCacheBackend($cache, 'link_relation_type_plugins'); } /** * {@inheritdoc} */ protected function getDiscovery() { if (!$this->discovery) { $directories = ['core' => $this->root . '/core']; $directories += array_map(function (Extension $extension) { return $this->root . '/' . $extension->getPath(); }, $this->moduleHandler->getModuleList()); $this->discovery = new YamlDiscovery('link_relation_types', $directories); } return $this->discovery; } }