Skip to content
Snippets Groups Projects
Commit 305b2f38 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2309889 by tim.plunkett, dawehner: Fixed DrupalKernel requires a...

Issue #2309889 by tim.plunkett, dawehner: Fixed DrupalKernel requires a Drupal\Core\*\Plugin directory for annotated classes to be discovered.
parent c58bca37
No related branches found
No related tags found
No related merge requests found
@todo This must be here because DrupalKernel will only allow namespaces to
provide plugins if there is a Plugin subdirectory, and git does not allow
empty subdirectories. This file should be removed once
https://www.drupal.org/node/2309889 is fixed.
......@@ -1010,13 +1010,22 @@ protected function compileContainer() {
// Get a list of namespaces and put it onto the container.
$namespaces = $this->getModuleNamespacesPsr4($this->getModuleFileNames());
// Add all components in \Drupal\Core and \Drupal\Component that have a
// Plugin directory.
// Add all components in \Drupal\Core and \Drupal\Component that have one of
// the following directories:
// - Element
// - Entity
// - Plugin
foreach (array('Core', 'Component') as $parent_directory) {
$path = DRUPAL_ROOT . '/core/lib/Drupal/' . $parent_directory;
$parent_namespace = 'Drupal\\' . $parent_directory;
foreach (new \DirectoryIterator($path) as $component) {
if (!$component->isDot() && $component->isDir() && is_dir($component->getPathname() . '/Plugin')) {
/** @var $component \DirectoryIterator */
$pathname = $component->getPathname();
if (!$component->isDot() && $component->isDir() && (
is_dir($pathname . '/Plugin') ||
is_dir($pathname . '/Entity') ||
is_dir($pathname . '/Element')
)) {
$namespaces[$parent_namespace . '\\' . $component->getFilename()] = $path . '/' . $component->getFilename();
}
}
......
@todo This must be here because DrupalKernel will only allow namespaces to
provide plugins if there is a Plugin subdirectory, and git does not allow
empty subdirectories. This file should be removed once
https://www.drupal.org/node/2309889 is fixed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment