Hi. First time poster- I am new to Drupal, but have a few years PHP experience.

Using the CCK, I have defined a field group named group_factsheet which comprises 3 custom fields. I am quite comfortable with altering the theme/template files for the individual fields, by creating a new file named content-field-field_name.tpl.php in my theme folder and adjusting that as necessary. I am unfortunately not able to do the same with the field groups.

I have tried a number of different naming structures, including:

  • fieldgroup-simple.tpl.php
  • fieldgroup-simple-group_name.tpl.php
  • group_name.tpl.php
  • (etc.)

I have also tried editing the fieldgroup-simple.tpl.php file in /modules/cck/modules/fieldgroup, but with no luck. I am clearing my cache constantly, so the problem can't be there either.

The problem seems to be, as far as I can tell, that that .tpl file is never even reached, as the theme_fieldgroup_fieldset() function in fiedlgroup.module file seems to be returning my html (line #868). If I change the return value of this function, I can see results.

My question is: is there any way to style a fieldgroup in the same way that I style my custom fields? Using a template file in my /theme folder, I need to build a table layout. I look forward to hearing from you. Thanks.

Comments

digitalfrontiersmedia’s picture

aviddiviner, it just so happens that I came across this very same problem today. I, too, for consistency's sake am looking for a method to implement the tpl.php instead of going with a theme override.

Please report back if you discover the solution. I'll do the same.

Cheers,
Stephen

radom’s picture

Hi,
I also had problems with fieldgroup-simple.tpl.php.
The solution that worked for me is to hook the function theme_fieldgroup_fieldset($element) in template.php. Copy the function from fieldgroup.module (in cck) and paste it as function [mytheme]_fieldgroup_fieldset($element) in template.php.
Now you can make the group collapsible, change attributes, add class, change title with the language ...