Skip to content

Commit 644c2bb

Browse files
committed
Fix drush-ops#2219. twig-compile should find templates in all active themes.
1 parent 763db0c commit 644c2bb

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

commands/core/core.drush.inc

+15-5
Original file line numberDiff line numberDiff line change
@@ -1341,11 +1341,21 @@ function drush_core_execute() {
13411341
function drush_core_twig_compile() {
13421342
require_once DRUSH_DRUPAL_CORE . "/themes/engines/twig/twig.engine";
13431343
// Scan all enabled modules and themes.
1344-
// @todo Refactor to not reuse commandfile paths directly.
1345-
$boot = \Drush::bootstrap();
1346-
$searchpaths = $boot->commandfile_searchpaths(DRUSH_BOOTSTRAP_DRUPAL_FULL);
1347-
$searchpaths[] = drupal_get_path('theme', drush_theme_get_default());;
1348-
$searchpaths[] = drupal_get_path('theme', drush_theme_get_admin());
1344+
// @todo refactor since \Drush\Boot\DrupalBoot::commandfile_searchpaths is similar.
1345+
$ignored_modules = drush_get_option_list('ignored-modules', array());
1346+
$cid = drush_cid_install_profile();
1347+
if ($cached = drush_cache_get($cid)) {
1348+
$ignored_modules[] = $cached->data;
1349+
}
1350+
foreach (array_diff(drush_module_list(), $ignored_modules) as $module) {
1351+
$searchpaths[] = drupal_get_path('module', $module);
1352+
}
1353+
1354+
$themes = drush_theme_list();
1355+
foreach ($themes as $name => $theme) {
1356+
$searchpaths[] = $theme->getPath();
1357+
}
1358+
13491359
foreach ($searchpaths as $searchpath) {
13501360
foreach ($file = drush_scan_directory($searchpath, '/\.html.twig/', array('tests')) as $file) {
13511361
$relative = str_replace(drush_get_context('DRUSH_DRUPAL_ROOT'). '/', '', $file->filename);

commands/core/drupal/environment.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function drush_module_invoke_all($hook) {
256256
* Returns a list of enabled themes. Use drush_get_themes() if you need to rebuild
257257
* and include hidden as well.
258258
*
259-
* @return array
259+
* @return \Drupal\Core\Extension\Extension[]
260260
* A list of themes keyed by name.
261261
*/
262262
function drush_theme_list() {

0 commit comments

Comments
 (0)