Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Oct 2013 at 17:03 UTC
Updated:
29 Jul 2014 at 23:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gábor hojtsyPlugins using list_themes() as well in their constructor to set up common things like YAML based discovery are not unit testable due to this and require custom wrappers to avoid using list_themes() direct. That is pretty painful. In short +1.
Comment #2
dawehnerLet's see how much the world crashes.
Comment #4
dawehnerHa, this time with the actual interface.
Comment #6
tstoecklerLooks good from skimming over it. I would have expected ThemeHandler handler to live in \Drupal\Core\Extension, however, is there a specific reason for not doing that?
Comment #7
dawehnerNo, there is no reason at all. If we decide to not move the theme handler to the extension directory we might should rename it to module, as this is what left. But I agree with you that the extension directory might be the better place.
Comment #8
dawehnerStarted with a bunch of unit tests while waiting on some of the other ones.
Comment #10
dawehnerSome fixes and more unit tests.
Comment #11
dawehnerComment #13
dawehnerSome more test fixes.
Comment #15
dawehnerFix the remaining tests.
Comment #16
amateescu commentedThe $used_keys argument doesn't seem to be needed anymore.
80 chars.
The docblock of this method is missing typehints for params and return
Why do we need the helper function here?
Missing docblocks.
I think the interface should have a different description than the class.
Comment #17
dawehnerThank you for the review!
I don't want to have the accumulator as part of the interface nor public method.
Improved the doc of the default implementation.
Comment #18
amateescu commentedThe interdiff looks good but I think you uploaded an old version of the patch because it contains
and inside it only the $key parameter is actually used..
Comment #20
dawehnerGood catch, here is a proper patch.
Comment #21
amateescu commented:)
Since the patch needs a reroll anyway for that debug(), I found a few lines that need to be rewrapped.
Comment #22
ParisLiakos commentedwhat exactly this property is? i cant figure it out.it is used only in the test. what is the usecase for this:S
how about turning those test methods into one with the help of a data provider?
Comment #23
dawehnerWe want to be able to not call system_list() so we wrap that method and override the behavior in our test code.
This technique is basically the same as mocking some of the dependencies.
Good point!
Comment #24
ParisLiakos commentedaaah..ok..i got it now, thanks.
dont kill me, but i just saw this:/ it needs docs
otherwise its ready to go imo
Comment #25
Crell commentedThis needs an @deprecated.
This needs a @deprecated.
@deprecated.
@deprecated. And any others that just wrap the service.
This isn't a new bug, but that data is no longer in the database. It's in YAML/CMI.
This is seriously not injectable??? (Ibid for the next several methods.)
Comment #26
tim.plunkettAddressed #24 and #25.
Yes Crell, stuff isn't always injectable. You always seem surprised by this, but no issues are opened...
Comment #28
tim.plunkett26: theme-2109287-26.patch queued for re-testing.
Comment #29
Crell commentedI am surprised when it's a new system in D8. New systems in D8 that aren't injectable but are just a bunch of functions make Crell sad. ;-(
Comment #30
gábor hojtsy@Crell: Drupal 8 development was open long enough before the DIC / injectability craze kick in :)
Comment #31
gábor hojtsyBTW this issue would help remove some stub code from config_translation as well :) In fact the lack of unit testability of the theme integration of config translation ignited this issue! Yay :) Thanks all!
Comment #32
tim.plunkettJudging by the other "normals" in the RTBC queue, this is certainly major.
Comment #33
tim.plunkettRerolled after #1886448: Rewrite the theme registry into a proper service
Also after discussion with @dawehner, decided to move this to Drupal\Core\Extension, next to ModuleHandler. It makes more sense that way, and the result can even be seen by the reduced use statements.
Comment #34
markhalliwellMissing docblocks
Shouldn't we add @deprecated in docblock for this function?
Comment #35
dawehnerThank you for the reroll and the review!
Comment #37
markhalliwellI think the patch in #35 isn't the correct one. None of the docblock changes seem to have made it in
doGetBaseThemes(),getSystemListingInfo()or_system_rebuild_theme_data().Comment #38
dawehnerRight, here is one.
Comment #39
markhalliwellStill missing docblock.
Comment #40
dawehnerUps.
Comment #41
amateescu commentedBack to rtbc.
Comment #42
sunGreat work, @dawehner!
A straight conversion is definitely a good first step — although I'm a bit concerned about DX due to the difference/disparity to ModuleHandler, so after committing this, I think we should proceed with #2024083: [META] Improve the extension system (modules, profiles, themes).
As a result of both, we should be able to finally resolve the epic #1067408: Themes do not have an installation status, which is still critically required to make CMI/staging work properly for themes :-)
Lastly, there are still a whole bunch of procedural functions being invoked here, for which we should create follow-up issues (not blocking a commit here).
Comment #43
sunSorry, my last comment was meant to reference #1067408: Themes do not have an installation status as CMI blocker. (corrected)
Comment #44
dawehnerI totally agree, there are a lot of things to solve everywhere. As you see in the patch there is still great coupling between system module and the theme system which is for itself horrible to understand.
Comment #45
star-szrReroll and pulling in a change from #1851018: Improve breakpoint configuration implementation., relevant interdiff attached.
Comment #46
dawehnerI like the interdiff! Thank you for your patch!
Comment #48
dawehner45: 2109287-45.patch queued for re-testing.
Comment #50
star-szrAnother reroll, just a context change in core.services.yml.
Comment #51
star-szrFixing test failure due to some new CSS added in #1986074: Buttons style update.
Comment #53
dawehnerBack to RTBC
Comment #54
kim.pepperSome very minor code style issues:
Needs full stop.
Needs full stop.
Exceeeds 80 chars.
Exceeds 80 chars
Newline before @return
Missing param comment
Missing return comment
Missing comma
Needs full stop.
Missing return comment
Long arrays should be broken into individual lines.
Comment #55
kim.pepperFixes for #54
Comment #56
catchNot the fault of this patch at all, but with these configurable for entity view modes these really ought to go.
Does the CSS cache need to be cleared when a theme is enabled? It's not going to change the contents of any files, only the set of files, which results in new aggregates anyway.
I'd also expect that to happen at the end of the process rather than the beginning, if it's actually necessary - because the cache could be regenerated before the rest of the work is done.
system_info()?
It does feel wrong but I can't think of a way around this at the moment.
Is this now used anywhere outside the module and theme handler? I suppose in system module somewhere still.
Comment #57
dawehnerThank you for the review!
I tried to keep the exact same flow as before, which also had drupal_clear_css_cache() at the beginning. Should we really try to figure out the best way here?
Sure.
Other places are: file.install, menu_link.install, and quite often in user.module.
Comment #59
catchOpened #2149631: Don't clear the CSS cache when installing themes.
Let's leave the others and handle them later on.
Comment #60
dawehner57: theme_handler-2109287.patch queued for re-testing.
Comment #61
kim.pepperLooks like catch's comments have been addressed, so back to RTBC
Comment #62
catchCommitted/pushed to 8.x, thanks!
Needs a change notice for the new service and the deprecation.
Comment #63
kim.pepperSuggested change notice:
list_themes(), theme_enable() and theme_disable() have been replaced with a new service
Drupal 8 has introduced a new 'theme_handler' service for managing themes. The procedural functions from Drupal 7 have been deprecated.
Drupal 7:
Drupal 8:
Comment #64
kim.pepperChange notice here: https://drupal.org/node/2150863
Comment #65
kim.pepperComment #66
kim.pepperComment #67
gábor hojtsyShould we have an issue to change the existing uses? Eg. there is significant code in config translation to be removed working around this not being a service :)
Comment #68
andypost@Gabor it makes a lot of sense! Filed #2151469: Clean-up usage of deprecated list_themes() and _system_rebuild_theme_data() in favor of theme_handler service
Comment #70
tim.plunkettCrossposting the issue to remove @todos pointing to this issue: #2188991: Use ThemeHandler instead of list_themes() in unit tests