Problem/Motivation
The Radix 6.0.8 Drush command radix:create fails on Drupal 11.4.x because it invokes the deprecated Drupal core script web/core/scripts/drupal
Drupal 11.4 deprecates calling core/scripts/drupal and requires using the new vendor/bin/dr script instead.
The failing code is in Commands/radix/SubThemeCommands.php around line 165:
$process = new Process([
'php', $drupalRoot . '/core/scripts/drupal', 'generate-theme',
'--starterkit', 'radix_starterkit',
$themeName,
'--path', 'themes/custom',
'--description', $description,
]);
Steps to reproduce
Use a Drupal 11.4.x project based on drupal/recommended-project. Install Radix 6.0.8:
composer require drupal/radix
Verify that the command is discovered by Drush:
./vendor/bin/drush --include=/path/to/project/web/themes/contrib/radix list | grep radix
This correctly returns:
radix:create (radix) Creates a Radix sub-theme.
Then run:
./vendor/bin/drush --include=/path/to/project/web/themes/contrib/radix radix:create new_theme
The command fails with:
PHP Deprecated: Calling drupal is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use the `dr` script instead.
PHP Fatal error: Uncaught Error: Failed opening required ‘…/web/vendor/autoload.php’
Proposed resolution
Do not invoke core/scripts/drupal directly. For Drupal 11.4+, the subtheme generator should invoke vendor/bin/dr instead. A local workaround that works in a standard drupal/recommended-project layout is:
$process = new Process([
dirname($drupalRoot) . '/vendor/bin/dr', 'generate-theme',
'--starterkit', 'radix_starterkit',
$themeName,
'--path', 'themes/custom',
'--description', $description,
]);
This avoids the deprecated core/scripts/drupal entrypoint. Relevant Drupal change record https://www.drupal.org/node/3584928
Remaining tasks
Update Commands/radix/SubThemeCommands.php to use the supported Drupal CLI entrypoint. Ensure compatibility with Drupal 10.3, Drupal 11.x, and Drupal 12.x if needed.
User interface changes
None
API changes
None
Data model changes
None
Issue fork radix-3608254
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
braintec commentedComment #3
arx-e commentedI met the same error trying to create a subtheme in Drupal 11.4 and replacing this line
'php', $drupalRoot . '/core/scripts/drupal', 'generate-theme',with this line
dirname($drupalRoot) . '/vendor/bin/dr', 'generate-theme',as proposed in the issue description, fixed the error and made the creation of a subtheme run just fine.
Maybe a note should be added in the front page until the issue gets corrected.
Comment #6
darkdimfixed
Comment #7
arx-e commentedYeah it is ok for Drupal 11.4+ but what about previous versions?
Comment #8
arx-e commentedComment #9
darkdimchanged
Comment #12
arx-e commentedoops we did the same thing at the same time. I went on to hide my copy of MR.
Comment #13
ultimikeTested with 11.4.4 and appears to be working fine.
-mike