Problem/Motivation
The following issue/patch removed the "logo" feature from _system_default_theme_features():
#2005546-27: Use branding block in place of page template branding variables (site name, slogan, site logo)
There have been unforeseen consequences to removing this from the default features of a theme.
- If a user saves the form without
$form['logo']
present, it can potentially be removed from the theme settings config and cause a theme's logo to not be shown. - A user cannot change the logo if a theme does not explicitly specify this feature in their .info.yml file, thus having to also define the defaults.
- Using the "Global settings" logo (the current workaround) doesn't work for sub-theme(s) where different logos are required.
Proposed resolution
- Add the "logo" feature back to
_system_default_theme_features()
and\Drupal\Core\Extension\ThemeHandler::$defaultFeatures
Remaining tasks
Create patch
User interface changes
- The "Logo" details section on a specific theme settings page will show up again and allow users to upload a custom logo for a specific theme.
API changes
None
Data model changes
None
Original Report:
The Logo Image Settings field is not appearing on theme specific forms, only on Global Settings.
This error is coming from Drupal 8.0.0-rc4 and is still happening on Drupal 8.0.0.
I did not payed attention to the error until today, thinking it was consequence of my code testings.
Just install a fresh Drupal 8.0.0 and reproduce the error.
Eventually the logo will not be rendered on the front end. This I cannot reproduce yet, but notice that when first appear the error.
When debugging theme form notice that $form['logo']
is not set on hook_form_system_theme_settings_alter()
Comment | File | Size | Author |
---|---|---|---|
#27 | Welcome to Drupal 8 - Drupal 8 2015-12-14 21-17-01.png | 5.97 KB | hatuhay |
#27 | Bartik - Portal INFP 2015-12-14 21-16-29.png | 10.95 KB | hatuhay |
#26 | regression_the_logo-2620176-26.patch | 3.94 KB | joelpittet |
#26 | interdiff.txt | 1.5 KB | joelpittet |
#22 | regression_the_logo-2620176-22.patch | 2.95 KB | joelpittet |
Comments
Comment #2
hatuhay CreditAttribution: hatuhay commentedComment #3
xjmI also noticed this as of RC3 I think (at least the behavior described in the issue title title) but thought it was by design. I haven't encountered any issue with the logo not being rendered, though.
Comment #4
xjmComment #5
hatuhay CreditAttribution: hatuhay commentedI have been able to reproduce when the logo disappear.
When I change the settings of the theme. Meaning, adding or taking out a theme settings variable, rebuild the theme settings string without the logo information.
So this will not happen often, but eventually updating a theme with more or less settings options will make the logo disappear.
Comment #6
joelpittetWas the logo disappear related to color in bartik? If so there is a patch here #2619332: Color scheme config changes aren't reflected in cached pages that is RTBC to resolve that.
Comment #7
hatuhay CreditAttribution: hatuhay commentedHello,
No it is not related to bartik, I notice and reproduced error on contribute themes.
From fresh installation did not appear on theme´s settings form.
After changing setting options (dev environment), logo is not rendered any more.
Comment #8
joelpittet@hatuhay it may still be related to cache like the one I mentioned. If you clear cache does the logo re-appear?
Comment #9
hatuhay CreditAttribution: hatuhay commented@joelpittet,
The real problem is the the logo settings not appearing on a THEME settings form.
The logo is not rendered after modifying theme settings (on development), because it is not saved on the settings array. This unlikely to happen on a production environment.
Comment #10
joelpittetOh sorry I miss-read the comments and didn't follow the issue summary through.
This may have happened around the time we moved the logo/branding variables into the block or maybe even earlier in some CMI change for overrides.
It would be ideal to know which commit this occurred on. RC3-4 would help narrow it down. If it was working in RC3 and not in RC4 you can use git bisect to narrow down which one.
Comment #11
markhalliwellComment #12
hatuhay CreditAttribution: hatuhay commentedThe patch on the new (duplicate) issue does not solve the problem.
I am not happy either in the way this was treated.
This issue is well documented and exposed in a way that was easy to be found if you look for the error.
Comment #13
joelpittet@hatuhay Completely agree, we usually close the newer one (which is the other one) unless they were further ahead with a solution or more details on the problem.
Comment #14
markhalliwellCan we stop with the theatrics please? I'm sorry that I closed this issue in favor of the other one. I had already created that issue (after searching for an existing one with no luck) and uploaded a patch. Yes, this issue documents the side-effect and lengthy explanation for simply saying it no longer shows up. However this issue did not actually provide any helpful information about what or why the issue is actually occurring. It also didn't pinpoint the exact commit/issue/patch that caused this regression (#2005546-27: Use branding block in place of page template branding variables (site name, slogan, site logo)).
I seriously don't understand what you're so upset about. I'm not looking for "points" either, that's not what this is about. It's about actually providing a patch to fix the problem at hand. The ego and snarky remarks towards someone who is also just trying to help (with an actual patch) is rude and mean. This kind of behavior is what led to me leaving core dev and it's certainly not enticing me to come back anytime soon. Thanks...
---
Now, regarding this actual issue. The patch from the duplicate issue was apparently incomplete. Someone had a wonderful idea to duplicate the same array in
\Drupal\Core\Extension\ThemeHandler::$defaultFeatures
without removing the legacy function or adding any sort of documentation linking the two... fun how messed up the theme system (not twig) is, isn't it.Here's a new patch that does fix the issue (with screenshots this time to prove it). Thanks for being so "supportive" to your fellow community member.
Before:
After:
Comment #15
markhalliwellComment #16
joelpittet@hatuhay I should have said @markcarver is likely not "looking for points" he probably figured he was further along in that other issue. Which is not uncommon. So I guess I didn't "completely agree". And seems to have got further before realizing the duplication.
@markcarver thank you for moving the patch to this issue and iterating on it.
Anyways, regarding the patch. One thing I noticed was in ThemeSettingsForm::buildForm() on line 140
Should that also have logo in it? Considering 181 #states is looking for it?
I'm not sure just a guess based on reviewing what is changing in the patch.
Comment #17
markhalliwellAccording to the issue that took these out, no. The logo is now a block and if a user wishes to not use the logo, it can remove the block (or change which pages it shows up on). So the "toggle" makes no sense on the form anymore.
What that issue failed to realize though, is that it should be a theme that chooses to completely remove the logo feature as an "opt-in" instead changing the "defaults".
As far as the states on 181 goes, yes, that should probably come out. I'm attaching a new patch (no interdiff since it's so small).
FWIW, that entire form needs some serious touch-ups. My IDE lights up like already Christmas when I view it. I really don't have the energy for that though.
Comment #18
joelpittetThat's probably a good plan to remove #states, thanks. Fixing the whole form could get into scope creep land anyways, don't bother, we can put a follow-up for that.
Adding a tag for regression tests.
Comment #19
joelpittetAssigning to myself for the tests.
Comment #20
markhalliwellMinor IS typo changes.
Comment #21
joelpittetBit of a simplistic test but it should suffice, though I noticed there is a test explicitly testing the opposite, I'm kinda curious if it will fail, but it didn't fail already so I wonder if it's testing anything...
\Drupal\system\Tests\System\ThemeTest:191
Comment #22
joelpittetPut the wrong one up Mark informed me on IRC. Don't expect a difference in results.
Comment #23
hatuhay CreditAttribution: hatuhay commentedOK, taking out "looking for points", it was not appropriate neither fair.
Test the patch and confirm the logo appearing on contributed theme's and sub theme´s configuration forms.
Please note that on line #433 of the ThemeSettingsForm is another reference to 'toggle_logo'.
Comment #26
joelpittetThanks for the heads up @hatuhay.
I removed that
toggle_logo
and also removed the seemingly useless test for the non-existence of the logo path field. Which either never gets called or is not testing the right thing.Now that the field is showing up. Is it doing what is expected of it? Could someone manually test the theme override and maybe take a screenshot or two proof the logos are being used on the front end. So far our screenshots are of the admin form it would be nice to know that this feature still actually affects the front end logo.
Comment #27
hatuhay CreditAttribution: hatuhay commentedConfirmed logos are working on frontend:
Comment #28
joelpittetCool thanks, feel free to set the status to RTBC if you think we've sufficiently solved the problem @hatuhay.
Comment #29
star-szrI don't think this is critical.
Comment #30
star-szrThanks all, I do think this is RTBC. The test code that's being removed I agree is not really testing anything at this point.
Can we get a follow-up please to remove or at least deprecate _system_default_theme_features()? It's only used in one place and we can add a getter to ThemeHandler instead IMO.
Comment #31
Jeff Burnz CreditAttribution: Jeff Burnz commentedNot sure about removing the state, does that create a UX issue? Removing a progressive disclosure etc?
Comment #32
markhalliwellCritical because there can be loss of data/setting (from IS):
_system_default_theme_features()
will have to be deprecated as there's at least one contrib release that I know of that uses it currently. I suppose an entirely separate issue could be created for that, but I don't think it would be too difficult to just do it here and now. My original patch failed because of this duplication of code, it'd be nice to get rid of that.And no, removing the states doesn't create a UX issue. If anything, it ensures there isn't a future UX issue in case something changed in the States API that suddenly caused it to hide (not collapse) the details for logos because "toggle_logo" doesn't exist. That toggle was originally taken out in #2005546: Use branding block in place of page template branding variables (site name, slogan, site logo) and there shouldn't be any states on that form element for a non-existent toggle.
Comment #33
star-szrIMO let's keep the scope as is, especially if you consider it critical. I still don't.
Comment #34
cilefen CreditAttribution: cilefen commentedThis is not data loss in the sense that we mean for "critical".
Comment #35
markhalliwell(Rhetorical) So a site's logo disappearing isn't a big deal?
It has been abundantly clear that the theme system (not twig) was greatly belittled and overlooked in core.
(Sarcasm) Of course it makes sense any of its data loss would be as well.
I have no reliable "steps to reproduce" (mostly because I don't have the time to chase down the randomness of this), but I too have encountered this phenomenon (like @hatuhay) where the logo is simply "gone" after a multitude of cache rebuilding/theme setting saving (which happens when you're the one actually [re-]building a theme).
Whatever, I really don't have the time or desire to squabble over stupid and petty semantics.
I will gladly "demote" the priority of the issue if it can let people just focus on getting the flipping issue fixed.
Comment #36
catchAgreed on critical if the logo is disappearing.
Also removing [regression] from the title, regressions are neither worse nor better than other kinds of bugs.
Comment #37
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!