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.
Hi mario,
..found some more time :-)
You should write the fieldset in "function theme_pollfield" like that:
...
$form = array();
$form[$fieldname] = array(
'#type' =>'fieldset',
'#title' =>t('Extra cck fields'),
'#collapsible' =>TRUE,
'#collapsed' =>TRUE,
because if someone uses vertical tabs this cck field is better included. ( Now the fieldset is not displayed as fieldset in vertical tabs)
Cheers Kai
Comment | File | Size | Author |
---|---|---|---|
#8 | pollfield_589918.patch | 841 bytes | hadsie |
#7 | pollfield_589918_2.patch | 605 bytes | hadsie |
#5 | pollfield_fieldset.patch | 727 bytes | hadsie |
Comments
Comment #1
Apfel007 CreditAttribution: Apfel007 commentedHi,
I'm back from holiday.
Did you have a look on it?
Cheers
Comment #2
mario_prkos CreditAttribution: mario_prkos commentedI am glad you back. I hope you enjoyed your holiday. Yes I did check out about this issue. As I understand theme function their output should be some kind of html code which can bu used to print content of node. Did you have in mind using Form API to build fieldset and then using drupal_render to generate html or you have something else in mind. Pleas, correct me if I misunderstand something. Looking forward to see more comments and contributions.
Cheers, Mario
Comment #3
Apfel007 CreditAttribution: Apfel007 commentedHi mario,
I'm at the start of coding drupal.. :-) but yes - if I understood everything right, I would suggest the form api..
This should be the right way..
Cheers Kai
Comment #4
Apfel007 CreditAttribution: Apfel007 commentedWhat did you think about this?
Comment #5
hadsie CreditAttribution: hadsie commentedI've attached a quick patch that turns the theme_pollfield into a proper themed fieldset. I don't think it's necessary in this case to drop the fieldset into form_alter, since this is actually displaying the pollfield field, not additional settings as other modules often add.
The other issue is that the title is being overridden by a new title "Pollfield settings", but I don't think that makes sense, it should use the title set on that particular field. What if you have two different pollfield fields on a single node? You wouldn't be able to differentiate the two.
I think you could also add the fieldset properties right into the $element in pollfield_pollfield_process() and that would probably be a more ideal way. All your theme_pollfield module would need to do then is
return drupal_render($element);
Note that this will should also take care of #651066: Node form : "Pollfield settings" is untranslateable
Comment #6
mario_prkos CreditAttribution: mario_prkos commentedYes, I agree with you and I will fix this in dev version soon as possible. Thank you for your contribution. Soon dev version will be release. Also, I will probably do some other changes so than I will do it this in second way you mention. For now I will use your patch you provide for us, thanks again.
Comment #7
hadsie CreditAttribution: hadsie commentedI've made a slight modification with this, and patched against the latest dev version. This patch allows the developer to also override the collapsible / collapsed fieldset settings if they run a hook_form_alter.
Comment #8
hadsie CreditAttribution: hadsie commentedI missed the #attributes in the last patch.
Comment #9
hadsie CreditAttribution: hadsie commentedJust looking through the latest dev version and this looks to be fixed now. Thanks Mario!
Still testing it but looks good.
Comment #10
mario_prkos CreditAttribution: mario_prkos commentedGreat, let me know is there any problem so I can put this in release version!
I appreciate very much any help on testing because it takes me lots of time.
Mario.
Comment #11
igorik CreditAttribution: igorik commentedHi, last patches nor the first code doesn't work for me. (and it is mainly already implemented in pollfield module)
but i still can't got pollfield fieldset into vertical tabs...
any help?
thanks
Igor
Comment #12
mario_prkos CreditAttribution: mario_prkos commentedI think you have to declare it in settings.php it is explained in vertical tabs docs. Try it let me know how is going.
Comment #13
nibblebot CreditAttribution: nibblebot commentedfixed?
Comment #14
bryan kennedy CreditAttribution: bryan kennedy commentedThis is still not working fully, with the D6 vertical tabs backport.
Comment #15
bryan kennedy CreditAttribution: bryan kennedy commentedJust clarifying the title.
Comment #16
bryan kennedy CreditAttribution: bryan kennedy commentedI spent some time on this tonight and got a whole lot of nowhere. The latest dev code does have the patches that Apfel007 suggested. however, I am still not seeing any pollfield fieldsets in the vertical tabs. I must say I am no expert on the form API. If anyone else has time to look at this code and suggest some changes I would appreciate it.