X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fbootstrap_layouts%2Fsrc%2FBootstrapLayoutsPluginManager.php;fp=web%2Fmodules%2Fcontrib%2Fbootstrap_layouts%2Fsrc%2FBootstrapLayoutsPluginManager.php;h=c6041e54b484077a648c067621d207dd9d199d4f;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsPluginManager.php b/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsPluginManager.php new file mode 100644 index 000000000..c6041e54b --- /dev/null +++ b/web/modules/contrib/bootstrap_layouts/src/BootstrapLayoutsPluginManager.php @@ -0,0 +1,117 @@ +getArrayCopy(); + + foreach ($class_loader->getPrefixesPsr4() as $prefix => $paths) { + // Remove trailing path separators. + $prefix = trim($prefix, '\\'); + + // Remove the DRUPAL_ROOT prefix. + $path = str_replace(\Drupal::root() . '/', '', reset($paths)); + + // Only add missing contrib theme namespaces. + if (preg_match('/^(core|vendor)/', $path) === 0 && !isset($namespaces[$prefix])) { + $ns[$prefix] = $path; + } + } + + // Replace the namespaces data. + $namespaces->exchangeArray($ns); + + // Construct the plugin manager now. + parent::__construct('Plugin/BootstrapLayouts', $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name); + + // Set the theme handler and manager. + $this->themeHandler = $theme_handler; + $this->themeManager = $theme_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('container.namespaces'), + $container->get('cache.discovery'), + $container->get('module_handler'), + $container->get('theme_handler'), + $container->get('theme.manager') + ); + } + + /** + * {@inheritdoc} + */ + protected function alterDefinitions(&$definitions) { + if ($this->alterHook) { + $this->moduleHandler->alter($this->alterHook, $definitions); + $this->themeManager->alter($this->alterHook, $definitions); + } + } + + /** + * {@inheritdoc} + */ + protected function providerExists($provider) { + return $this->moduleHandler->moduleExists($provider) || $this->themeHandler->themeExists($provider); + } + +}