Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Kernel] Enable theme commands #4128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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;
}

}