Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/Bootstrap/DrupalKernelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
use Drupal\Console\Core\Utils\DrupalFinder;
use Drupal\Core\Extension\ExtensionDiscovery;

/**
* Trait DrupalKernelTrait
Expand Down Expand Up @@ -167,13 +168,31 @@ public function addDrupalServiceFiles($servicesFiles)

protected function addDrupalConsoleThemeServices($root)
{
$themes = $this->getThemeFileNames();
$themes = $this->getThemeFileNames($root);
$servicesFiles = [];
foreach ($themes as $theme => $filename ) {
$servicesFile = $root . '/' .
dirname($filename) .
"/console.services.yml";
if (file_exists($servicesFile)) {
$servicesFiles[] = $servicesFile;
}
}

$this->addDrupalServiceFiles($servicesFiles);
}

private function getThemeFileNames()
private function getThemeFileNames($root)
{
$extensions = $this->getConfigStorage()->read('core.extension');
$listing = new ExtensionDiscovery($root);
$listing->setProfileDirectories(array());

return isset($extensions['theme']) ? $extensions['theme'] : [];
$themes = [];
foreach ($listing->scan('theme') as $theme => $value ) {
$themes[$theme] = $value->getPathname();
}

return $themes;
}

}