Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I would like to use this module for the user edit form, but not for the registration form. Is there some way I can programmatically disable the module for the registration form, or enable/disable it based on the URL? What would be the cleanest way to do that? Thank you
Comment | File | Size | Author |
---|---|---|---|
#7 | 28-09-2013 11-05-38.jpg | 57.01 KB | fugazi |
Comments
Comment #1
arnoldbird CreditAttribution: arnoldbird commentedInitially it looks like my best bet might be to work with CSS. For example, override the following CSS at URLs where I don't want the field_group module to affect output:
.horizontal-tabs .horizontal-tab-hidden {
display: block;
position: absolute;
top: -100000px;
}
That's in horizontal-tabs.css. I'm using horizontal tabs at the moment.
In other words, I need to un-hide some hidden fieldsets. I'll also need to hide the tabs, of course.
This is a very useful module.
Comment #2
arnoldbird CreditAttribution: arnoldbird commentedActually, my solution in #1 is a bad solution, because it hides the fieldsets but doesn't really disable them. They're still there, in the HTML, and this makes it impossible to re-order the fields programmatically in a hook_form_alter -- unless you only want to re-order them within the fieldset but not move them out of a fieldset.
I'm still poking around in field_group.module, hoping there is some way to disable this module entirely for some form_ids or URLs, while still using it in other situations.
Comment #3
arnoldbird CreditAttribution: arnoldbird commentedI feel like the answer must lie in the module's pre_render functions? Looks like the functions in field_group.api.php are intended as a way for other modules to intervene, but I'm not sure how.
Comment #4
arnoldbird CreditAttribution: arnoldbird commentedI have it narrowed down to one line in field_group_pre_render_tab().
Around line 826...
If I comment out that second line so the type is never set to fieldset, then the fieldsets don't render as vertical tabs. Instead, all fieldsets are displayed in series, sans tabs. So I just need to figure out how to unset that #type from my module. hook_form_alter doesn't seem to provide any opportunity to do this. This seems to be happening later in the processing. I also tried playing with the pre_render functions in the module's api file, but have not had any luck with that. Maybe hook_page_alter is something to try.
I did find a way to control the ordering of the fieldsets in hook_form_alter:
$form['#groups']['some_group_name']->weight = 123;
Comment #5
arnoldbird CreditAttribution: arnoldbird commentedIn my theme:
forms.js:
The above removes the surface effects of field_group for a particular form, but does not actually remove the groups. Groups can be re-ordered, though, by setting the weight as shown in #4. With that, for just about all intents and purposes, field_group is not in effect for a particular form.
Comment #6
xcafebabe CreditAttribution: xcafebabe commentedThe next code worked for me
Comment #7
fugazi CreditAttribution: fugazi commented# 6 does not work. Have it inserted in the template.php. I need to add something else. I want the user profile settings to groups not only let in the register.
Comment #8
fugazi CreditAttribution: fugazi commentedups it works, after a server restart everything is ok
Comment #9
MXT#6 works very well: thank you xcafebabe!
Comment #10
W01F CreditAttribution: W01F commentedHmm... also tried inserting this snippet into template.php, but can't get it to work. First I tried it with "function MYMODULE_form_alter" but guessed that was wrong. So I changed it to "function field_group_form_alter" - but that doesn't seem to work either. Any suggestions for what I'm doing incorrectly? Thanks!
Comment #11
fugazi CreditAttribution: fugazi commented@WOLF maybe you have forgotten "mymodule", to change in your theme name.
my_themes_name e.g. bartik = bartik_form_alter
Comment #12
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commented