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.
It was possible to change the label text of every field per build mode/view mode in ds-6.x-1.x. Currently only the the label position can be adjusted - is this by design or is this an oversight (i.e. would you like a patch for this)?
Best, Fredrik
Comment | File | Size | Author |
---|---|---|---|
#28 | labelanddescription-1053912-28.patch | 1.79 KB | frega |
#26 | 1053912.patch | 55.38 KB | swentel |
#22 | 1053912.patch | 29.01 KB | swentel |
#22 | field-output.png | 10.83 KB | swentel |
#17 | semantic-fields-1.png | 16.82 KB | jyve |
Comments
Comment #1
swentel CreditAttribution: swentel commentedThat's not an oversight. I just haven't figured out how I should handle the UI and if Field API stores the label per view mode. If you have patch, feel free to submit, it's on my list, but not as a high priority right now.
Comment #2
swentel CreditAttribution: swentel commentedChanging title for more features
Comment #3
mortendk CreditAttribution: mortendk commentedevil themer subscribing
Comment #4
swentel CreditAttribution: swentel commentedFirst patch : important: the UI is horrible at this moment, that needs work.
At this point this should work though:
- other label per field
- remove all classes on outer div
- add extra classes on outer div
- change wrapper on the item div
The magic happens with overriding theme_field. The function is now theme_ds_field() in ds_extra module.
This patch is as an extra, so you need to enable the ds extras module and enable it on the 'extras' screen.
Patch works on latest dev. Needs work though of course, especially on the UI, but any other suggestions for making this even more cooler are appreciated of course!
Comment #5
swentel CreditAttribution: swentel commentedBetter patch with all tests passing. Will work on the UI somewhere this weekend or next week or if anyone else has the courage of course :) Again, more options, let me know!
Comment #6
mortendk CreditAttribution: mortendk commentedim gonna dig in tomorrow night and play around with it :)
Comment #7
mortendk CreditAttribution: mortendk commentedso been looking a bit into it seems to do some of the stuff, but lacks the last bits to make it bring it up to epic level ;)
right now we can remove the classes from the div wrappers - but no option for killing of the divs completely (no cure for divititis?)
The hopes was a field that can end up with the wrappers we want (or *gassssp* no wrappers at all!)
so sometingh like this pseudocoe:
Comment #8
swentel CreditAttribution: swentel commentedThat's what I thought you'd say and I had in mind :) Will look into that further, colleagues are looking on the UI right now.
Comment #9
swentel CreditAttribution: swentel commentedUpdated patch with some UI and JS (note needs latest dev again, since I pushed the css/ds.admin.css) already - no functional changes yet.
Comment #10
kclarkson CreditAttribution: kclarkson commentedwill this patch allow me to style each field like in 6.x?
Comment #11
swentel CreditAttribution: swentel commentedNo, this is D7 only
Comment #12
swentel CreditAttribution: swentel commentedUpdated patch:
- can remove all wrappers
- can remove the 'field-items' wrapper
- can remove the field wrapper
It still needs extra classes on the field wrapper.
Another thing is that it's maybe too technical right now and we need to try another workflow. we'll see once we got the (extra) classes on the field wrapper in.
Comment #13
swentel CreditAttribution: swentel commentedEven better patch, with a nice screenshot attached too :) The field classes box is now available too.
Comment #14
mortendk CreditAttribution: mortendk commentedwow that is smooth and sweet & just what the good doctor ordered for the cure for divitis !!!
but it looks like the label for inline vs above selected dont change from a span to a div?
Besides of that little thing, this is absolutely amazing :)
Comment #15
swentel CreditAttribution: swentel commentedAha, didn't know that should happen for labels, makes sense indeed.
I'm also going to add a 'global' setting too at the top of the table that will affect all fields by default so you don't need to click like hell if you have a lot of fields.
Comment #16
mortendk CreditAttribution: mortendk commentedyup a global setting would make a lot of sense, though im enjoing every click where i kill off a ton of divs *div div div die die die*
Comment #17
jyve CreditAttribution: jyve commentedAfter a decent brainstorm, this is my proposal to make this awesomeness even more awesome:
1. Rename 'Field settings' to 'Output settings' so that it does not class with the current 'Field settings'.
2. Change the 'Output settings' form to the screenshot attached for more versatility.
By default all checkboxes are on, and the default 'element' and 'class attribute' fields should be filled in with the Drupal defaults.
If the class field is emptied, then no class tag is printed, but the tag itself is still printed.
The label row depends on the other selectbox where you choose to show the label or not.
Unchecked rows should have greyed out input fields.
3. I would then propose to drop the styles for fields as they are now, otherwise you have to go back and forth all the time.
4. Under the Display Suite menu, there should be a 'General output settings' section where you also get the 'Output settings' form, and a checkbox to make those settings the default settings for all fields. This then goes across all view modes and content types. However, you can still overwrite this default since a radiobutton will appear above the 'Output settings' form in the field UI, where you can choose 'general', or 'custom'. See second attached image.
Hope this makes sence. Mortendk feel free to add your feedback!
Comment #18
kclarkson CreditAttribution: kclarkson commentedSo will these changes allow me to style each field individually utilizing CSS?
Based on what I can tell from the posts it looks like you can not only style with CSS but also remove div tags.
Just wanted to be sure I am using this feature correctly.
Comment #19
swentel CreditAttribution: swentel commentedThese changes will allow you to change the output of the field, more or less like the comment in #7. Either starting from a default with the possibility to override them per field individually, but adding or removing wrappers and styles/classes on the fields.
Comment #20
jyve CreditAttribution: jyve commentedTo be more specific about your question, it will not allow you to change the CSS, it will allow you to optimize the default HTML output so that you have cleaner HTML and can write cleaner CSS.
Comment #21
mortendk CreditAttribution: mortendk commentedjyve sounds like clever suggestion you have :)
im all for it :P
Comment #22
swentel CreditAttribution: swentel commentedHere's the start of the patch that tries to incorporate the stuff mentioned in #17 and a screenshot too :)
With this patch, by default, you get nothing, nada markup around fields (except for the label which gets a div).
todo: default setup.
I'm also thinking about something extreme for ultimate power where you'd be able to define special theming functions (if you really need to go extreme) and select a theming function for that particular field. So in the end, this patch might do this:
- remove everything by default (working)
- setup a default (needs to done yet)
- change markup per field (working)
- define external functions which you can select (starting with one, which would be the original theme_field() function)
Any advice on that theming function or am I going to wild here ?
Comment #23
mortendk CreditAttribution: mortendk commenteddefining extreme functions would überrock so hard i dont have words for it!
a simple thing could be a links thats rewritten with classes n crap markup for some fance jQuery thingie (if you wanna go that ways
Comment #24
frega CreditAttribution: frega commentedwould love to test & help with one :) but i can't the patch to apply; whilst i am not totally new to the fancy git thing, i might just get something totally wrong ... after checking out 7.x-1.x branch; running git apply -v 1053912_4.patch gives me:
Checking patch css/ds.admin.css...
Checking patch ds.api.php...
Checking patch ds.field_ui.inc...
Checking patch ds.module...
Checking patch ds.registry.inc...
Checking patch js/ds.js...
Checking patch modules/ds_extras/ds_extras.module...
error: while searching for:
// Clear module_implements cache and rebuild menu.
cache_clear_all('entity_info:', 'cache', TRUE);
cache_clear_all('module_implements', 'cache_bootstrap');
menu_rebuild();
}
/**
* Implements hook_permission().
*/
function ds_extras_permission() {
error: patch failed: modules/ds_extras/ds_extras.module:131
error: modules/ds_extras/ds_extras.module: patch does not apply
Checking patch tests/ds.base.test...
Checking patch tests/ds.entities.test...
Checking patch tests/ds_test.module...
Comment #25
swentel CreditAttribution: swentel commented@frega yeah, that patch isn't up to date anymore, working further locally. I'm hoping to get a new reroll somewhere next week.
Comment #26
swentel CreditAttribution: swentel commented@frega and the rest: new patch - ze killer patch :)
* it's now possible to select a default function, ds comes with 3:
1. default core theme_field
2. theme_ds_field_reset: resets all wrappers
3. theme_ds_field_custom: uses custom settings per field
* You can define your own custom functions through hook_ds_field_theme_functions_info() eg
* comes with tests for nearly every possible option, so I think we're safe, also for people wanting to fiddle, you can rely on the tests if you want to submit your own patch.
Make sure you take the latest dev version of DS (either clone or wait for the next build since I've commited some other stuff today).
Open question: should I completely kill the preprocess and process functions too or just leave it like they are ? (maybe that could be an option).
* Todo:
- Nicer interface and UI, eg. the custom wrappers input field should dissapear if you do not select the custom field template.
- Run benchmarks (although I'm pretty sure we're safe here)
Alright, almost there, if all goes well, we should be able to get this out next weekend!
Comment #27
swentel CreditAttribution: swentel commentedI'v committed this as is (+ some extra goodies). Clone and be amazed! Release pretty imminent.
Comment #28
frega CreditAttribution: frega commentedChecked it out right now - looks very nice, indeed! I have a minor request regarding the rather non-sexy custom label-issue (which is more pressing for me actually that divitis :):
Patch attached does the following:
- Change label of link to indicate where label override/custom label can be set
- If label override is in place, show the override (@todo: use JS to reflect changes à la vertical tab summary!)
- Minor UX: Added a title to the Field Template "function"-select box.
(I dared to move this to "needs review", i hope that's ok ...)
Comment #29
swentel CreditAttribution: swentel commentedGood points, UI changes are always welcome :)
- I like the idea of printing the label that has been overriden, however, it's now printed twice (on the left and in the link) which is redundant imo. The link could simply stay 'Label | Field template'.
- I think we should reverse the logic on the field label like this: My new label (Original: Label) - feels more intuitive (to me at least)
- I personally don't like the 'Field template type' label on the select box. 'Field template' should be enough I think (we had that originally too, but left it out because we felt it was taking up too much space). I'm not sure about the advanced help, but I guess that's because there isn't really a structured help right now anyways .. :)
Needs work because of the js for the label. I'll try to roll a patch with JS tonight.
edit: deleted my crazy idea, let's focus on the easy ones first :)
Comment #30
swentel CreditAttribution: swentel commentedCommitted and pushed :
- label on select box (Field template)
- link is now 'Label & field template)
- Original label next to the current label
- update js trigger that updates the label in the row
maybe, if I'm crazy enough, I'll try to change the rows in such a way that it looks like in D6, but that's no priority, the faster this gets out the better :)