Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
field_ui.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Jan 2010 at 08:10 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
lyricnz commented(note: previous comment didn't say this: but bug is for *existing* field only)
Comment #2
yched commentedThe intended behavior is that the 'Label' input gets pre-populated with the label of the selected "existing field".
Comment #3
lyricnz commentedIt looks like Drupal.settings.fields[xxx].label is NULL, I'm looking into why now.
Comment #4
lyricnz commentedLong story short, FIELD INFO doesn't appear to contain labels, only INSTANCES of fields do. The way the existing-field dropdown works is that it uses the FIRST label found for a given field. We can modify the JS to do the same (I'll submit a patch soon), but this functionality is a bit grotty, from a usability perspective.
Comment #5
lyricnz commentedSee attached patch. I've refactored field_ui_existing_field_options() into a utility function, and a wrapper; then used the utility function to get the labels/widgets needed for the javascript.
Please review carefully! I only started using D7 yesterday :)
eg: should the field info constructed have the t(label) or the raw label?
Comment #6
lyricnz commentedReroll, and diff from the root directory.
Comment #7
retester2010 commented#6: existing_field_ui.patch queued for re-testing.
Comment #8
yched commentedStrange, I can't seem to apply ?
Comment #9
yched commentedDOh, I overlooked the date on #6.
Rerolled, and fixed / reorganized a bit. Should work ok now.
Steps to reproduce :
- On a default install, go to admin/structure/types/manage/page/fields ('Manage fields' for 'Page' node type)
- 'Add existing field' row shows two potential fields to add : field_image, field_tags (defined for 'article' but not for 'page')
- when you select one of those,
the 'Label' input should get populated with the Label of the existing instance,
the 'Widget' select should be updated to show widgets for the corresponding field type (image or taxo_term)[edit: forget it, that part works], and should be prepopulated with the widget used by the existing instance.None of the two work currently. I don't know at which point this got broken. Note that this is JS-only, so there's no writing tests for this.
Comment #10
yched commented[edited out]
Comment #11
yched commentednevermind, not critical.
Comment #12
lyricnz commentedThanks for the update. Kindof surprised nobody else on D7 noticed it...
Comment #13
mlncn commentedComing over belatedly from #735204: vanishing label text from manage fields page.
Comment #14
mlncn commented#9: field_ui_add_existing_js-684310-9.patch queued for re-testing.
Comment #16
lyricnz commentedThis bug still happens in beta 3.
Comment #17
lyricnz commentedBumping to "major" because UI is broken
Comment #18
webchickI agree this sounds annoying, but it's certainly not "major".
Comment #19
lyricnz commentedComment #20
yched commentedReroll of #9. Tested manually, works.
Steps to reproduce :
- On a default install, go to admin/structure/types/manage/page/fields ('Manage fields' for 'Page' node type)
- The 'Add existing field' row shows two potential fields to add : field_image, field_tags (defined for 'article' but not for 'page')
- when you select one of those, the 'Label' input should get populated with the Label of the existing instance.
JS behavior only, not bot-testable.
Comment #21
yched commentedbeloved bot, can I haz test ?
Comment #22
bleen commentedsubscribing
Comment #23
greenmother commentedThis yched's patch works fine. How about to commit it in D7?
Comment #24
yched commented#21: field_add_existing_prepopulate_label-684310-21.patch queued for re-testing.
Comment #26
greenmother commented#21: field_add_existing_prepopulate_label-684310-21.patch queued for re-testing.
Comment #28
ksenzeeWith the patch in #21 I was seeing two ' - Select an existing field - ' options: one being added to the $existing_field_options array, and one being added as the #empty_option. I removed the one from the $existing_field_options array and rerolled the patch for git and coremageddon. It seems to work fine. I hope the bot agrees.
Comment #29
yched commentedTrue, thanks for the reroll ! Now we need someone to RTBC...
Comment #30
lyricnz commentedCan confirm that bug still present in D8, and that #28 fixes it. Pedant: shouldn't we use '…' or '…' or t('...') rather than '...'?
Comment #31
Niklas Fiekas commentedMaybe we should only update the label automatically, when the user hasn't manually entered something.
Other than that:
Comment #32
yched commentedUpdated patch:
- Re-adds the sorting.
- Removes the custom '...' ellipsis when truncating the strings and uses the one built in truncate_utf8()
- Only overwrites the "Label" input if it didn't receive manual edits (or if it's back to empty)
I'd rather keep the function name.
Comment #33
Niklas Fiekas commentedApplies, works, looks awesome. Presumably passes the tests. Thank you :)
Minor point: Maybe val(...) instead of attr('value', ...)?
Comment #34
yched commentedThe rest of core is more consistent on val() vs attr('value'), so yeah.
Comment #35
Niklas Fiekas commentedAlright. Thanks.
Comment #36
lyricnz commentedYay, works for me.
Comment #37
catchLooks like this has had plenty of manual testing, so committed/pushed to 8.x.
Doesn't this also need a backport?
Comment #38
Niklas Fiekas commentedWorking backport with just the filenames changed attached.
Comment #39
elc commentedApplies cleanly to current 7.x HEAD and functionally identical to D8 version which has been committed.
Comment #40
webchickOh man! This bug is really annoying. So happy to see a fix!
Committed and pushed to 7.x. Thanks! :)