When adding/editing a new content type, the user cannot add new fields on the initial 'add' page or manage page
admin/structure/types/add
admin/structure/types/manage/[content type]
The only option is to 'Save content type' which directs them back to their list of content types.
To improve the flow, let's have a new button with the label 'Save & Add Fields' that will direct people to the field management page at
admin/structure/types/manage/[content type]/fields
(This is from #614396: Clarify UI text on page for adding new content types comment #3. Bojhan, anything to add?)
Comments
Comment #1
lisarex commentedShould be on the Add page only. See attached mockup. :)
Comment #2
Bojhan commentedSo I am wondering, if this is part of the editing, or the creating a new content type workflow. I am to argue that since we will have Manage fields on content type page, it should not be part of editing a content type.
Comment #3
lisarex commentedBojhan thanks, I saw your response in IRC. I can't edit the original issue (or can I?) but I clarified it should be for Add page only in comment 1.
Comment #4
rszrama commentedHere ya go. I tried to follow other button text patterns and so used "and" instead of "&" and sentence capitalization.
Can anyone who sees this tell me if there's already an issue regarding the fact that you lose the breadcrumb when you go to edit a content type? You can't click straight back to the list of content types.
Also, is it a new thing to have return statements at the end of form submit handlers? They seem quite unnecessary...
Comment #5
rszrama commented(Forgot to set to "needs review." Also, the patch is for an include in the node module folder, so I tweaked the component.)
Comment #6
rszrama commentedBah, and I just realized why this was marked for the fields_ui.module. Should've dawned on me sooner that this wouldn't be so simple... for those following along at home, this button should only show if the Field UI module is enabled. Gonna have to work it into that module as a form alter instead of this painless patch. : P
Comment #7
webchickI'd like to see this in before UX freeze. It'd definitely make the workflow here much smoother.
Comment #8
lisarex commentedHi, I've done a quick demo to show how this should work.
http://www.vimeo.com/7604361
Cheers!
Comment #9
sign commentedHere is a patch based on #4, moved to field_ui.module
Comment #10
theunraveler commentedI tested this patch and it seems to work just fine. The code looks good too.
Comment #11
lisarex commentedLooks great buuuuut.... if I return to the edit the content type, the Delete button looks odd in the middle.
I think there's a slight preference for this button to only appear on the initial Add page, not subsequent, so that would mean not messing around with reordering the buttons.
See attached.
Comment #12
webchickYeah, I agree with that. Let's put it there only on add.
Also, that $form_state['build_info']['args'][0]->type thing looks weird. It looks like $form has a #node_type index that'll work for this?
Comment #13
zserno commentedAttached an updated version of #9.
Changes:
- Based on #12, changed $form_state['build_info']['args'][0]->type to $form['#node_type'].
- Added a new check in submit handler, because previous versions of patch redirected regardless which submit button was clicked.
- Updated comments (periods and capital letters).
Comment #14
zserno commentedForgot to mark as patch...sorry.
Comment #15
zserno commentedOh, so testing bot is re-checking attached patches, so there's no need to re-attach it. :)
My bad...anyway, please review it.
Comment #16
damienmckennaWorked as described:
Anyone else want to review it?
Comment #17
webchickThis looks great, and really speeds up the interaction users are going to want in about 8/10 of the cases.
I made one teensy tweak which was to change:
to:
The first is perfectly correct, but we use empty() more often than not for legibility.
Committed to HEAD!
Comment #18
zserno commented@webchick Wohoo!
Thanks for enlightening me. This was my first commit to Drupal and it feels really great! :)
Comment #19
yched commentedSorry to jump in late.
This needs to be
strtr('_', '-', $form_state['values']['type']);, or this will break if the node type name has a _.Ya know, the 'underscore to dash' conversion for node types in URLs we all love ;-)
Comment #20
yched commentedEr, or even better:
$form_state['redirect'] =_field_ui_bundle_admin_path('node', $form_state['values']['type']) . '/fields';
Comment #21
zserno commentedAdjusted the patch according to #20.
Although I tried and it works with '_' too, but it's definitely more consequent.
Comment #22
webchickAh, good catch, yched. Committed to HEAD.
zserno: CONGRATS on your first core patch! WOOT! :D
Comment #23
lisarex commentedYay! So glad this one made it in :)
Comment #25
traviscarden commentedLittle follow-up: #1665920: "Save and add fields" should be "Save and manage fields"