For example, I've got Location module, which alters node edit form and adds a new "locations" element with "#type" = "fieldset". I wonder If I can alter node edit form (or try other hook) so it will move Location's module form edit fieldset content to the existing horisontal tab which was created using Field UI earlier.
Also it would be good if I could move the whole "additional_settings" fieldset to the other horizontal tab.
I've tried to add elements to #groups array and set parent for fieldset, but there is no effect.
Thank you.
Comments
Comment #1
nils.destoop commentedYou can move your field to a group by adding it to the #group_children array with a form_alter.
Example:
Comment #2
Stalski commented@zuuperman & all:
We should somehow be able to detect those form altering. Maybe:
- run the function on front end , do a check by taking a diff with original and after form alter somehow.
- Stash all those customly added html-wrappers (may not be fieldsets alone, but also a div with a prefix and suffix)
- Provide them in the field UI screens
- Take all field groups and "know" which ones need to be handled by ? callback, default function?
Bad idea?
- Edit: @ Julia Trushina : does the solution provide by zuuperman fix your case?
Comment #3
Stalski commentedChanging title to have a concept. It would be very nice to have a generic system for all those who do things a bit different.
Comment #4
swentel commentedIn DS there' the possibility to define extra fields through the user interface. We could do this as well for field_group which already predefines some popular modules.
Mind if I create a patch for this ? It will introduce a settings screen like in DS, but hey, it's all for the benefit of everybody :)
Comment #5
swentel commentedtypo in title
Comment #6
Stalski commentedAssigning to Swentel who is currently investigating this rather difficult problem.
Comment #7
Stalski commentedI can add here that #fieldgroups property is leading to let field_group know it can (pre_)render the element(s).
Comment #8
swentel commentedMarking this a dupe of #1280974: Allow to show custom in code declared elements as field_group in the UI - we have some proof of concept working already, more to come later.
Comment #9
swentel commented