Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 Jul 2019 at 18:08 UTC
Updated:
13 Mar 2020 at 19:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
volegerHere the patch, But it's deprecation removal without replacement. So postpone it on 9.x.
Comment #3
mikelutzThis still needs work in D8, and it looks to be a bigger issue than I had originally realized. Flipping through the original issue when libraries-override was added way back in 8.0.x-RC, it looks like the intention was to deprecate the stylesheets-remove key in the theme yml files to be removed in Drupal 9. We didn't know how to do deprecations then, and the CRs don't mention the deprecation of stylesheets-remove. The only real documentation is the @todo remove in drupal 9 spread throughout the system.
First, we need to confirm with RM and/or front end FM that stylesheet-remove should and can still be deprecated.
Then we need to properly deprecate it by detecting its use on discovery and triggering a deprecation error so themes can know to stop using it
And we need a proper change record indicating that it will not be supported in Drupal 9
Finally the BC layer supporting it for Drupal 8 needs to have proper @internal annotations, and a follow up issue to actually do the removal when the branch opens.
As it sits, the @deprecated tag on ActiveTheme::getStyleSheetsRemove() can't stay there because core needs to use that method, and we can't remove support for that key in Drupal 9 without proper deprecation and CRs and documentation.
Comment #4
berdirThis deprecates it explicitly by doing a @trigger_error() on discovery, including naming the theme that uses this feature.
IMHO keeping getStyleSheetsRemove() as @deprecated without a @trigger_error() is fine, it really is deprecated, so seems strange to change to @internal or so, which also wouldn't be correct as it is not an internal helper function, it is a public API, just deprecated.
There are almost no reasons for calling it anyway, http://grep.xnddx.ru/search?text=getStyleSheetsRemove shows just a few special theme things as well s devel/webprofiler which are just calling it to show the info. So I wouldn't worry about it too much.
We have two test themes that are using the deprecated key, but I suspect they are used in quite a few tests and we'll need to move that to separate test themes that we only use for a single deperecation test. So this should have a chunk of failing tests.
Comment #6
mikelutzLets convert the stylesheet-remove on those two themes over to libraries-override syntax and see if anything breaks. If not, then we can add an explicit test for the deprecation system around the stylesheet-remove key.
I've come around to the opinion regarding these methods that we use but are deprecated should just be undeprecated until Drupal 9 opens. The method shouldn't be deprecated right now because it is used. as soon as the 9.0.x branch opens, the method use can be removed, and it can sit there and be deprecated and return an empty array and trigger an error until Drupal 10, becuase at that point it is unneeded and so that is when it should be deprecated. I realize that is just a hard line by-the book approach that doesn't really take into account how much the method is used at all, so I'm more than happy to be overruled, I just feel like a public method on an object provided by the theme manager probably shouldn't just disappear per our BC policies, but there's not reason it can't just sit there doing nothing during the D9 cycle.
Comment #8
mikelutzThere's a third theme that uses it, and I didn't use it correctly in one spot.
Comment #9
berdirLooks good, need a test theme for deprecation testing and a corresponding test now :)
Comment #10
mikelutzHere's a dedicated test, and I'm un-deprecating the getStyleSheetsRemove method because I think the correct thing to do is deprecate it in Drupal 9 once it's no longer needed. If there's serious objection, I'll do something different, but I hate having a deprecated method that we can't trigger an error from. I really feel like the right thing to do is deprecated it once it's no longer needed/used by core.
Comment #12
mikelutzLet's base the legacy test theme off of classy. I don't want to have to add it to the subtheme list on another test.
Thinking/looking further for precedence on the idea of undeprecating ActiveTheme::getStyleSheetsRemove(), I notice that ThemeInitialization::prepareStylesheetsRemove Effectively performs the same type of a BC layer role and is not deprecated, it only has a @todo to remove in Drupal 9.0.x.
So I've cleaned up the documentation around both to indicate that they should be deprecated in 9.0.x once they are no longer needed.
Comment #13
catchI think we can probably mark methods like this @internal and still remove them in the 9.x branch, on the basis absolutely nothing outside the deprecated code paths should be calling them.
Comment #14
mikelutzHonestly, even if we couldn't remove it in the 9.0.x branch, I'm all for adding @internal anyway, just to discourage use.
Comment #15
mikelutzActually, let's add @internal to ThemeInitialization::prepareStyleSheetsRemove() as well.
Comment #17
longwave#15 needs rerolling due to conflict in core/lib/Drupal/Core/Theme/ActiveTheme.php
Comment #18
ravi.shankar commentedHere I have added a re-roll.
Comment #19
longwaveit's -> its
it's -> its
The deprecation is already done?
Comment #20
ravi.shankar commentedBack to NW as per comment #19.
Comment #21
andypostit needs to add trigger_error() to properly deprecate in 8
@todo require link to issue
so it was not properly deprecated, looks needs split into 8.x (properly deprecate) and 9.x (remove)
Comment #22
berdir> it needs to add trigger_error() to properly deprecate in 8
No, we still have to call this method, as it's still necessary if themes define it.
> so it was not properly deprecated, looks needs split into 8.x (properly deprecate) and 9.x (remove)
That's what the title says and this issue does? Yes, it wasn't _properly_ deprecated, but it already was deprecated in 8.0.
I think we can still remove it from D9, it's already being done in my Drupal\Core issue,
Comment #23
longwaveReworded some comments with stronger intentions and linked the @todos to the existing removal issue.
Comment #24
lauriiiThe deprecation was introduced in #2451411: Add libraries-override to themes' *.info.yml. It doesn't seem like the change record for that issue mentions the deprecation at all: https://www.drupal.org/node/2497313. I tried to search for another change record that would mention this, but it seems like we might not have properly announced that
stylesheets-removeis deprecated, and that it will be removed. I discussed this issue with @catch and we thought that we might have to schedule the removal to happen prior to Drupal 10.0.0.Comment #25
berdirOk, as discussed, updated the patch to change this to a D10 deprecation. I removed the "used in Drupal 8" part, as I think it's not necessary and will be used in 8 and 9.
I think this too is a beta blocker, just like every other D9 deprecation issue?
Also including a D8 patch, while git can actually auto-merge it, DrupalCI probably can't.
Comment #26
lauriiiThis doesn't seem like the correct issue to be reference here since this is a 9.0.x issue.
Comment #27
berdirWe can't create issues for D10 yet, so we could either create one in 9.x that says it's actually for D10 or juts remove the @todo.. I think we'll find this when searching for @trigger_error() then for D10.
Comment #28
lauriiiHow about just a comment along the lines of
@todo Remove in Drupal 10.0.x.?Comment #29
berdirworks for me, we already have such a comment. I'll try to provide that as a patch tonight, but maybe someone else can pick it up before then.
Comment #30
berdirUpdated those two instances.
Comment #32
longwaveRandom fail in WidgetUploadTest, requeued.
Comment #33
lauriiiI had a concern that not giving deprecation warning on this method could lead into someones code breaking accidentally when upgrading to Drupal 10.
I talked to @Berdir on Slack and he pointed out that the method has been marked internal and that there is only three usages in the contrib ecosystem: http://grep.xnddx.ru/search?text=getStyleSheetsRemove&filename=. Based on this I think it's fine for us to proceed with the current approach 👍
Comment #34
alexpottCommitted 9bb53f5 and pushed to 9.0.x. Thanks!
Committed 599d4e0 and pushed to 8.9.x. Thanks!
I considered backported to 8.8.x to get the improved deprecations there but considering the scope of the change - adding new @trigger_error()'s to runtime code - I would like a release manager +1.
Comment #37
gábor hojtsyAsked @catch he said