10 files changed, 48 insertions(+), 287 deletions(-)
This patch removes the category system from user edit pages. It also simplifies user rendering by removing a couple of custom theme elements and files (user-profile-category, user-profile-item). Category here is a holdover from profile.module which is out of core now. Future profile systems would be built upon Field API which currently has no notion of conditionally attaching to some forms and not others. If we get that, it would work for all entities, not just user. Also, most profile systems these days (i.e. Facebook) now use AJAX for partial profile edits.
Several large hunks just change indentation so I have left the indentation as is in this patch and left a TODO in its place. This makes for easier reviewing. I'd obviously finish this off prior to RTBC.
The motivation here is to cleanup the user entity in order for it to more smoothly fit into the upcoming expansion of the entity system (CRUD, ...).
Comment | File | Size | Author |
---|---|---|---|
#48 | category.diff | 42.71 KB | moshe weitzman |
#43 | category.diff | 42.42 KB | David_Rothstein |
#43 | interdiff-40-43.txt | 1.94 KB | David_Rothstein |
#40 | category.diff | 41.22 KB | moshe weitzman |
#38 | pic.diff | 40.52 KB | moshe weitzman |
Comments
Comment #2
Gábor HojtsyYay, great stuff! Agreed on the goal and approach. Removing cruft is good!
Comment #3
catchNice diffstat you've got there.
Comment #4
sunYes. Thanks for starting this, @moshe! Might even be something someone less experienced can complete?
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedComment #7
moshe weitzman CreditAttribution: moshe weitzman commentedComment #8
Crell CreditAttribution: Crell commentedDo we want to remove the fieldset for timezone? Even without profile categories it's still its own chunk of "stuff", and not directly related to removing the legacy $category nonsense. I'd like one of the UX folks to weigh in here.
And oh yeah, huge +1 subscribe. Less code in user.module++!
2 days to next Drupal core point release.
Comment #9
catchprofile2 is using this in D7, so this could use feedback from fago before full nukage.
Comment #10
Bojhan CreditAttribution: Bojhan commentedFollowing, I can chime in but not sure what to chime in on. The timezone functionality is primary there for more international sites, like the one we are on - to have useful time notations (especially on community sites this is important).
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedIMO, a fieldset with only one item in it clutters the UI and obfuscates the alter operation for coders. Modules that add more stuff can add own fieldset.
Comment #12
Gábor HojtsyI think its best to keep this issue for removing categories and do other tweaks in other issues, so we have less to argue about.
Comment #13
moshe weitzman CreditAttribution: moshe weitzman commentedWell, the render system specifically calls these fieldset containers categories so they are in scope IMO. See comment at top of user_view(). Further, noone has advocated for keeping them yet.
Comment #14
catch@Bojhan the question is whether the single timezone form item should have a fieldset around it or not. Moshe would you mind doing a before/after screenshot?
Comment #15
Gábor HojtsyThe user edit page is already very guilty of this. Contact module, system module (timezone), overlay module, locale module all put their one-form-item textareas in there. It gets unwieldy pretty fast. Once again I think this is not something we should resolve here. @moshe: I see http://api.drupal.org/api/drupal/modules--user--user.module/function/use... mentions categories, and that can be removed independent of other non-profile category related restructring, right?
This is how a normal user edit page looks like now with contact and overlay module enabled:
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commented@Gabor - thanks for the screenshot. This patch gets rid of all of those fieldsets. Sure, I could remove that from this patch. But thats more overhead for me to manage two patches. I probably won't do the fieldset one separately, to be honest. Noone has said 'I think we need to keep the one item fieldsets.' Until someone does, we are not actually avoiding a debate. We are creating work for ourselves.
You don't need to 'call in a UX person' in order to know that one item fieldsets are silly. You don't need a weatherman to know which way the wind blows.
Comment #17
sunI agree with @Gábor Hojtsy -- it's better to keep this issue and patch focused on the technical issue, for which we still need @fago's feedback, it seems.
The user view and edit pages didn't gain much love during the D7 cycle, and I think we should review and discuss them more carefully with the usability team to improve the UX. Many possible solutions come to mind there, and for a couple of them, we'd actually keep the fieldsets.
Comment #18
fagoprofile2 is using it, because its goal was to do what profile.module does, but with using entities and fields. Still, if it goes away profile2 could easily implement the same UI by providing its own menu items.
Unrelated to profile2, I'd really really love to see $category die. It's a weird user.module thing which doesn't make any sense in the area of entities. Next, removing it is going to save us quite some headaches when implementing the unified crud interface for the user entity.
Thus, huge +1 from my side.
Regardless how they are going to like, let's scrap $category and implement it in a sane way.
Comment #19
moshe weitzman CreditAttribution: moshe weitzman commentedAttached is Gabor's screenshot with this patch applied. The 3 fieldsets are gone and their contents remain (checkboxes and a select). This isn't the model of beauty either, but it is simpler, sensible, and better for devs as well (less nesting).
Comment #20
Bojhan CreditAttribution: Bojhan commentedPersonally I am totally fine with losing the fieldsets. There are many ways we can make this form more beautiful, but that should not be the aim of this issue. I am not sure which good looking ideas sun has in mind that are about retaining these fieldsets, but even then we should do that in a separate issue. Anyway, with or without I don't care - lets do any UX stuff in a new issue when this technical cleanup is done.
Comment #21
David_Rothstein CreditAttribution: David_Rothstein commentedInstead of removing the fieldsets, maybe #993592: Vertical Tabs on User Account Edit page is a better way to go? (In which case the fieldsets would still be there, technically.)
Also, the screenshot in #19 looks good, but what would we do about the other elements that are still in fieldsets even after this patch (user signature, user picture, etc.); shouldn't they be converted also? And what happens when a contrib module adds some actual (legitimate) fieldsets to this page? A mix of fieldsets and non-fieldsets sandwiched between each other doesn't seem like a good idea.
Comment #22
moshe weitzman CreditAttribution: moshe weitzman commented@david - sun made an oblique reference to vertical tabs in #17 and asked for UX input. That input came in #20 so we are now clear to proceed here.
Lets do as Bojhan suggests and tackle the jumbled form items elsewhere. FWIW, I plan to move user pictures and signatures to the user entity. Follow me at #1292470: Convert user pictures to Image Field.
Please folks - post a substantive review or mark RTBC.
Comment #23
fagoThis needs to be removed too.
Apart from that and the remaining indentation fixes the patch looks good to me.
This and user_view() reminds from another issue: We should fix our terminology and always refer to the user account as user account, not sometimes as profile. There should be no profile stuff left in user.module - it's the job of a profile module to build that. But that deserves its own user.module cleanup issue.
Comment #24
sunAlso reviewed this patch in-depth, and what @fago said is indeed the only remaining task (next to adjustment of indentations).
Comment #25
Crell CreditAttribution: Crell commentedI saw no issues other than the fieldset question, which is now resolved, so this gets a +1 from me to fix up #23 and then roll a with-indent-fixes version to commit.
Comment #26
moshe weitzman CreditAttribution: moshe weitzman commentedFixed #23 and indentations.
Comment #27
sunAs long as we don't have a UI concept for this form (like we have for node or node type edit forms), I think we should "still" enforce at least a pattern of module namespaces to prevent an infinite disaster of modules declaring arbitrary keys. At this point in time, the 'language' field is added by Locale module, so a top-level 'locale' form structure key seems to be required for me. (but doesn't require a fieldset, just the key)
Glad we're removing this anti-pattern ;) http://drupal.org/project/timezone would be happy if it would exist. :)
Missing indentation change here :)
-2 days to next Drupal core point release.
Comment #28
David_Rothstein CreditAttribution: David_Rothstein commentedThere are still some callers passing a 4th parameter to this function after the patch is applied. In at least one case (trigger_user_cancel()) it looks like it's still important.
It would be a lot cleaner to just pass the $form_id as a parameter to the function and compare against that instead.
****
Also, I still have questions about the fieldset change but apparently I didn't express them well. I'm going to try again, this time with a screenshot.
Comment #29
David_Rothstein CreditAttribution: David_Rothstein commentedLet me try my fieldset question again.
The attached screenshot shows what the user profile form looks like with the patch applied and lots of core features enabled.
Whereas before, we had the "important" stuff (e.g. username and password) at the top of the form outside of a fieldset, and a bunch of other stuff in fieldsets neatly at the bottom (thereby following our UI guidelines; see http://drupal.org/node/1087106), now we have a mishmash. There are fieldsets in the middle of the page, with some things outside of fieldsets above it and some things outside of fieldsets below it. And this doesn't even take into account what happens when there are contrib module installed.
I don't think I've seen this pattern anywhere else in Drupal, and it looks like it would be really confusing. If we're going against the UI standards, we need a reason for it.
In short: Getting rid of fieldsets is good if we actually got rid of all them. But getting rid of some fieldsets and leaving others in the middle of the page (sandwiched between other elements) is worse than just leaving everything in a fieldset like we have now (where it's at least consistent).
Comment #30
David_Rothstein CreditAttribution: David_Rothstein commentedJust to be extra clear, here's a screenshot of what the full page looks like in core now (without the patch). While it's not beautiful, at least it's consistent, and it basically follows the UI guidelines. I don't see how the UI changes in the patch are an improvement over this.
But to clarify, I do really love the rest of the patch, though :)
Comment #31
Bojhan CreditAttribution: Bojhan commented@David is right that fixing this partially makes little sense. However lets keep all talk around the actual UX of this form to a new issue and just commit this with no UI change. I do want people to keep in mind we can make partial fix's now, we are not at the end of the cycle.
Comment #32
moshe weitzman CreditAttribution: moshe weitzman commentedOK, the 1 item fieldsets are back. Also incorporated #27, #28.
Comment #34
moshe weitzman CreditAttribution: moshe weitzman commentedSome old code slipped back in. Hopefully fixes test fails.
Comment #35
David_Rothstein CreditAttribution: David_Rothstein commentedLooks pretty close, but found a few remaining issues reading through it:
I think the previous behavior of leaving it off the form entirely was intentional (to avoid polluting $user->data for all users, since that's where this overlay setting gets stored). Probably best not to change it here.
Is this accidentally left over from the fieldset changes?
Why is $method passed only in the first case, whereas before $category was only passed in the second case?
Looks like this is still missing an indentation change.
1. Still doesn't look like it will work correctly ('member-for' vs. 'member_for')...
2. Should we also change the label in user_field_extra_fields()? ("History" doesn't really make sense after this patch)
3. Just realized, I think we need an update function for this change (since the extra field weights are stored in the 'field_bundle_settings' variable in the database).
I think
'#type' => 'item'
is also still wrong, but not sure there's a good alternative currently, so we can leave it for a followup.Comment #36
moshe weitzman CreditAttribution: moshe weitzman commentedGood eyes ... Addressed all concerns in David's review, including upgrade path.
Comment #37
David_Rothstein CreditAttribution: David_Rothstein commentedSo close....
I read through again (mainly just read the new parts). Fix these and I think it's good to go.
I don't think this will work?
$settings[...][...]['summary']
should contain an array of the view modes, so it doesn't seem like the 'member_for' key will ever be set.What this needs to do instead is check for
$settings[..][..]['summary']
, move it to$settings[...][...]['member_for']
, and then unset$settings[...][...]['summary']
. That should hopefully do it.I believe this should be 'addtogroup' rather than defgroup (since the group is already defined elsewhere). So something like:
Didn't notice this before, but did now - I think we need to keep the
#weight = 5
around. This will keep it at the bottom of the profile by default (and match the default weight from the extra fields implementation).Is it me or did the logical condition here change (lots of
!
s seem to have moved around)?While we're at it, I still think it would be better to pass $form_id as a parameter to the function (it's just a helper function that appears to only be called from one place in the codebase anyway). Then you could check actual form IDs, with underscores rather than hyphens. But most important thing is to double check that logical condition.
Comment #38
moshe weitzman CreditAttribution: moshe weitzman commentedThanks. I addressed all of these, except for passing in $form_id separately. I see that as a non-issue.
I simplified the #access line by removing the !'s.
Comment #40
moshe weitzman CreditAttribution: moshe weitzman commentedSimplified language selector form so the function takes less params and the caller has to add #access. I like it this way better, and test bot should be happier.
Comment #41
David_Rothstein CreditAttribution: David_Rothstein commentedThese changes all look good to me, and I think it's ready to go. Sorry for the delay in following up on this.
I think the patch might not apply any more though. I'll trigger the testbot to find out.
Comment #42
David_Rothstein CreditAttribution: David_Rothstein commented#40: category.diff queued for re-testing.
Comment #43
David_Rothstein CreditAttribution: David_Rothstein commentedHm, I'm not sure why I had trouble applying the patch before. It works fine now.
This is good to go. I noticed a couple pieces of stale documentation left over (maybe they snuck into core in the meantime) and I've made those changes in the attached patch.
I'm marking this RTBC, since the only changes I made were pretty trivial documentation fixes. I'm also attaching the interdiff from #40 in case anyone wants to review those.
Comment #44
chx CreditAttribution: chx commentedWhen David Rothstein reviews a patch this throughly, I don't need to. Thanks. Nonetheless, I took a cursory look and things look OK. This is a gigantic step ahead because right now, saving a user is pretty much anyone's guess whether it works or not because categories could be dynamic and you have no idea what to pass to user_save to completely save back a user.
Comment #45
sunLooks good to me as well.
On the Locale module changes discussed above, normally I'm strictly following consistency and use all of the regular $form, $form_state(, and $form_id) arguments, since any kind of form building function possibly needs them (e.g., considering AJAX or any other required write access, especially to $form_state).
However, in this case, I think we're fine, since we're going to revamp the language selector through another issue in the queue anyway - don't want to hold up this patch further.
Speaking of, this patch removes a couple of files, so should wait after the core/ patch has landed - re-rolling should be easy.
Comment #46
catch#43: category.diff queued for re-testing.
Comment #48
moshe weitzman CreditAttribution: moshe weitzman commentedQuick reroll after /core patch. Keeping at RTBC. Lets see if test bot is happy.
Comment #49
catchThanks! Committed and pushed to 8.x. this will need a change notice.
Comment #50
xjmreprogrammer is working on a change notice for this issue. (Assigning to myself for the moment to avoid duplicated effort.)
Comment #51
reprogrammer CreditAttribution: reprogrammer commented@xjm suggested that I write a change notice for this issue during a Drupal core office hour. Therefore, I assigned this issue to myself.
Comment #52
reprogrammer CreditAttribution: reprogrammer commentedI wrote up a change notice for this issue and @xjm reviewed it.
Comment #53
xjmThanks @reprogrammer!
Comment #55
webchickI was porting a module and came across the removal of #type user_profile_item which was not really mentioned in the change notice. Rather than adjusting that one, I made a separate one here http://drupal.org/node/1893032 because it's what I would've found when searching. I did xref this issue there, however.
Comment #56
webchickAlso, updated http://drupal.org/node/1393236 with a reference to #user_category specifically (since that's what I hit in my module), and included a before/after code snippet.