Problem/Motivation
The current approach where the steps taken to generate a theme are defined in a centralized place works well with one starterkit theme. However, in future we'd ideally like to make it possible to use different themes as the starting point.
Proposed resolution
Allow starterkit themes to control how the theme is generated by adding and potentially removing steps that are taken to generate a new theme. This way the process to generate a theme could vary depending on which theme is used for generating the new theme.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3206217
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:
- 3206217-allow-starterkit-themes
changes, plain diff MR !1909
Comments
Comment #3
andypostComment #5
mglamanIn #3206219: Allow configuring which theme is used as a starterkit theme, we found areas of starterkit themes that may not be covered. This was done by allowing Olivero to be used as a starterkit in manual testing.
Specifically this comment: #3206219-11: Allow configuring which theme is used as a starterkit theme
Some of these may be gaps in the default centralized process and some may need to be handled by the themes themselves.
Comment #6
mherchelComment #7
mherchelahh! Posted summary change in the wrong issue.
Comment #8
lauriiiGood call on leaving out the Olivero specific problems found on #3206219-11: Allow configuring which theme is used as a starterkit theme. I think what's needed here is to come up with an API that would allow Olivero to extend the generic starterkit theme generator to correctly change the things mentioned there. I'm wondering if all that's needed is providing a "hook" for the starterkit themes to allow them to add additional code that should be executed towards the end of
\Drupal\Core\Command\GenerateTheme::execute?Comment #9
mglamanI imagine a file that can be autoloaded/discovered like a module's ServiceProvider class. This has to implement an interface which contains various integration hooks. Maybe just one big one. It doesn't get copied over, though, to the new theme.
This is the escape hatch for weird bugs until they get fixed in Drupal core.
This is the code I'm referring to
Comment #10
mglamanGoing to take a stab at this!
I don't remember our exact notes from our Slack discussions/calls. But I think the idea was:
* Themes provide a specific class to be invoked, which doesn't get copied over
* The class is invokable (__invoke) so we don't have to mess with methods names and bikeshedding, open-ended API
* The class __invoke should receive the destination path so it can make changes
Comment #11
mglamanTossing up initial proof of concept. Words will need to be tossed around and decided upon.
Comment #13
mglamanChanging the component to "Starterkit theme"
Comment #14
alexpottThis looks great.
Comment #17
lauriiiCommitted de48162 and pushed to 10.0.x. Also cherry-picked to 9.4.x. Thanks!