Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of #1971384: [META] Convert page callbacks to controllers
For instructions on how to convert a page callback into a controller, see the WSCCI Conversion Guide.
Comment | File | Size | Author |
---|---|---|---|
#18 | 1987850-route-system-theme-disable-13.patch | 8.32 KB | oenie |
#15 | 1987850-route-system-theme-disable-12.patch | 8.32 KB | oenie |
#15 | diff-1987850-route-system-theme-disable-11.txt | 3.84 KB | oenie |
#14 | 1987850-route-system-theme-disable-12.patch | 8.32 KB | oenie |
#14 | diff-1987850-route-system-theme-disable-11.patch | 3.84 KB | oenie |
Comments
Comment #1
vijaycs85Initial patch...
Comment #2
vijaycs85Adding the controller class that is missing in #1
Comment #3
amateescu CreditAttribution: amateescu commentedMissing an empty line here.
Config should be injected.
This should use RedirectResponse.
Comment #4
oenie CreditAttribution: oenie commentedI'm taking up this issue and joining it with issue #1987852: Convert system_theme_enable() to a new style controller
Comment #5
oenie CreditAttribution: oenie commentedamateescu,
You mention in comment #3 that the config should be injected.
I'm trying to find an example for this, but can't seem to find anything useful.
I tried injecting a ConfigFactory, but then i end up with the next error:
Drupal\Core\Config\ConfigImporterException: config.installer is already importing in Drupal\Core\Config\ConfigImporter->import() (line 219 of /Users/Jeroen/development/drupal/core/lib/Drupal/Core/Config/ConfigImporter.php)
Do you have any pointers or examples of where to look ?
Thanks !
Comment #6
amateescu CreditAttribution: amateescu commentedSure, you can use this one as an example:
StatisticsSettingsForm::create()
.If that doesn't work out, could you post your patch anyway so more people can help you debug it? It's also possible that this might be a bug coming from this newly committed issue #1890784: Refactor configuration import and sync functions.
Comment #7
oenie CreditAttribution: oenie commentedHere's my current patch, which to me seems rather complete, but ends up with the error mentioned in comment #5.
Maybe i'm missing something ?
Comment #9
cosmicdreams CreditAttribution: cosmicdreams commentedHere's a patch that implements a proper constructor and implements the ControllerInterface. As a result, I'm injecting the config factory and using in the disable() function.
Comment #10
kim.pepperNeeds comment
Should $config = $this->configFactory->get('system.theme');
Comment #11
cosmicdreams CreditAttribution: cosmicdreams commentedIn #7, I"m not getting the right set of config. This patch gets system.theme config properly.
Comment #12
amateescu CreditAttribution: amateescu commented@cosmicdreams, this issue was assigned to @oenie and he is working on it..
@oenie, I applied the patch locally (after fixing the conflict in system.routing.yml) and theme enabling/disabling works just fine, no errrors at all :) Let's try to feed the testbot an updated patch.
PS. I also fixed some trailing whitespaces and code style errors. Interdiff is to #7.
Comment #13
dawehnerLet's just inject the system.theme config object and not the full factory
/me hides ... single quotes.
Let's get rid of it ... they are menu callbacks.
Comment #14
oenie CreditAttribution: oenie commentedAnother try, including dawehner's comments.
I've attached an interdiff to the patch of comment 11
Comment #15
oenie CreditAttribution: oenie commentedLet's try that again as a patch.
Another try, including dawehner's comments.
I've attached an interdiff to the patch of comment #12 by amateescu
Comment #17
oenie CreditAttribution: oenie commented#15: 1987850-route-system-theme-disable-12.patch queued for re-testing.
Comment #18
oenie CreditAttribution: oenie commentedReroll of the patch against the current code.
Learning a bunch of new stuff :)
Comment #19
cosmicdreams CreditAttribution: cosmicdreams commentedLooks great!
Comment #20
alexpottCommitted f94711c and pushed to 8.x. Thanks!