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.
The show/hide descriptions links e.g. on the user permissions page or the admin/by-task page no longer work. Seems to be a side effect of #721436: Remove magical fairy saving of cruft from user_save().
Comment | File | Size | Author |
---|---|---|---|
#14 | 748976-4.patch | 3.38 KB | jpmckinney |
#12 | 748976-12.patch | 1.27 KB | jpmckinney |
#11 | 748976-11.patch | 1.27 KB | jpmckinney |
#7 | 748976-7.patch | 1.27 KB | jpmckinney |
#1 | show-hide-descriptions-748976-1.patch | 663 bytes | David_Rothstein |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedThis patch gets them half-working again (you can hide them now, but never show them again). The rest I'll try to follow up on at #721436: Remove magical fairy saving of cruft from user_save() in order to fix, since I think it's a more fundamental issue with the code in there.
We should also write a test for this.
Comment #2
andypostThis patch is a partial fix. Also there's a #220263: Generalize "Hide descriptions" link
Comment #3
catchThis should be a permanent cookie like the toolbar collapsed default rather than saved in user->data.
Comment #4
andypost@catch I think a cookie is not a permanent storage for users' settings. While we still have {user}->data this setting should live here, same as contact.module setting. User could visit /admin from different computers and should have the same admin-screen
Comment #5
catchI don't consider this a setting, it's rather a toggle. If we say that, then the toolbar should be using $user->data too.
Comment #6
andypostI think it'a good idea to separate UI settings and functional settings in different storage.
Comment #7
jpmckinney CreditAttribution: jpmckinney commentedA few things:
I don't understand the logic behind this:
Why do we clobber $edit['data'] when it's non-empty? It seems to me that I would want to clobber $account->data:
Indeed comment #57 at #721436: Remove magical fairy saving of cruft from user_save() does this switch, so at least one other person agrees.
Also, I haven't been following #721436: Remove magical fairy saving of cruft from user_save(), but it seems to be a known issue that $account->data is not always unserialized. This is a problem because array_merge will complain unless $account->data is unserialized. In this patch, I unserialize $account->data if it needs to be.
Anyway, this patch fixes the current issue. I don't want to get mixed up in #721436: Remove magical fairy saving of cruft from user_save(), but someone from there can come here and edit my patch to fit whatever develops in that other issue.
Comment #8
jpmckinney CreditAttribution: jpmckinney commentedComment #9
moshe weitzman CreditAttribution: moshe weitzman commentedI agree that this is and ephemeral pref like toolbar collapsed or the filter peristance on admin/content. so, this can be persisted in a cookie IMO. We have to move code out of $user->data anyway for D8, and might as well start now. We could do own cookie or re-use the drupal.visitor namespace.
Comment #10
aspilicious CreditAttribution: aspilicious commentedWoow I was wondering this week if I had to open an issue about remembering the state of the hide descriptions...
But apparently this discussion is alrdy started. A big plus for the idea.
I don't care if it's a cookie or not.
Comment #11
jpmckinney CreditAttribution: jpmckinney commentedRe-did it using Drupal.visitor cookie.
Comment #12
jpmckinney CreditAttribution: jpmckinney commentedFix missing semi-colon. By the way, do we really need a variable_get here? Will there really be a site administrator somewhere who would want to set admin_compact_mode to TRUE by default?
Comment #13
David_Rothstein CreditAttribution: David_Rothstein commentedI think a cookie might make sense but it's not 100% obvious that it does... and should we really be changing the feature in this issue, or just fixing the bug? :)
Anyway, #7 looks pretty good (except it is indeed tied up with the serialization mess at #721436: Remove magical fairy saving of cruft from user_save()) and #12 looks good as well.
Even if using a cookie, is it still possible to write a test for this? (I think it probably is.)
Comment #14
jpmckinney CreditAttribution: jpmckinney commentedRe-roll #12 with tests.
Comment #15
catchLooks good to me.
Comment #16
tobiasbfor me too
Comment #17
Dries CreditAttribution: Dries commenteduser_cookie_save() has such a weird function signature. The fact that it takes two arrays is just awkward, IMO. Anyway, not related to this issue.
Comment #18
Dries CreditAttribution: Dries commentedCommitted #14 to CVS. I fully agree that we should use cookies for this, instead of a database setting.
Comment #19
mfbBTW, I don't understand how this test passed without calling parent::setUp()?
Comment #20
andypost@mfb because no moduless need to install
Comment #21
mfbhmm but doesn't setUp() always have to call parent::setUp() to set up the database and testing environment?