Hi,

Could you had this feature ? Hide Group Label... when all fields empty

Thank you

(using last dev version)

Comments

yched’s picture

Status: Active » Fixed

True, this is annoying.

Whether a field is 'empty' (has no output) is decided at render time.
Fieldset-based display of fieldgroups currently use core's 'fieldset' FAPI element, whose theme function doesn't have this feature.

Fixed by using our own 'fieldgroup_fieldset' elements, that don't display anything is content is empty.

The change requires the theme registry to be rebuild, obviously.

chipway’s picture

Hi,

Thank you for your answer.

So, if I undestand, I have to do a specifc template file in order to hide group when empty ?

yched’s picture

Nope, just grab CCK's RC release on http://drupal.org/project/cck, and empty your site's caches
(using devel.module's 'empty cache' if you have devel, or the 'clear cached data' button on admin/settings/performance)

chipway’s picture

Ok,

Thank you.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

terry22’s picture

Hi, I'm trying to acheive the same thing: hide fieldgroup display if inside field is empty.
I got the last version of cck, but the fieldgroup still appears even if there is no content in it.
Is there a way to do this?

thank you for your help

Aurochs’s picture

same issue here
6.x-2.6
did you forget to fix it in the new release?

mmccollow’s picture

Status: Closed (fixed) » Active

I'm also using 6.x-2.6 and field groups that contain only empty fields are still being displayed. The 5.x fieldgroup.module had this code in fieldgroup_nodeapi():

        $visible = FALSE;
        foreach ($group['fields'] as $field_name => $field) {
          if (isset($node->content[$field_name])) {
            $node->content[$group_name][$field_name] = $node->content[$field_name];
            if ($node->content[$field_name]['#access'] && !empty($node->content[$field_name]['#value'])) {
              $visible = TRUE;
            }
            unset($node->content[$field_name]);
          }
        }
        if (!$visible) {
          // Hide the group, because the fields are empty or not accessible.
          unset($node->content[$group_name]);
        }

I don't really understand the 6.x module yet, but it's changed significantly, especially fieldgroup_nodeapi(). Should groups with nothing but empty fields still be hidden, or was that removed from 6.x-2.6?

WorldFallz’s picture

Category: feature » bug

definitely a regression between the 5.x and 6.x versions-- i haven't figured out the best way to fix it yet, but I'll post a patch if I do.

sf_wind’s picture

subscribe

SeanA’s picture

I can't reproduce this problem. If all fields are empty, the fieldgroup fieldset is not displayed. I had an old dev site that hadn't been touched in a while, so I tried it with CCK 2.2, 2.6, and 2.9. All with the same result: the empty fieldgroup was never displayed.

Could there be some other fieldset theming function from some other module or theme that is causing problems for others?

Possibly related:
#963180: Fieldgroup Templates
#599772: slate_fieldset in template.php causes problems with cck collapsable fieldsets

Vote_Sizing_Steve’s picture

Have you tried with a link field? Perhaps it's the url/title combination which causes this outputting of empty fieldsets in my site.

timd.mackey’s picture

I was running into this problem, and it turned out that my content-field .tpl files were the cause of it. Several of my field .tpl's had extra line-returns in them before and/or after the <?php if (!$field_empty) : ?> code block. I was able to solve it by going through all of my content-field .tpl's and removing any extra line-returns so that there was a maximum of one line return between the php code blocks.
ie- changing this:

<?php ... ?>
  
<?php ... ?>

to this:

<?php ... ?>
<?php ... ?>

fixed my problem.

giorgio79’s picture

Project: Content Construction Kit (CCK) » Field Group
Version: 6.x-2.x-dev » 7.x-1.x-dev
Component: fieldgroup.module » User interface

I am still getting this.

I gave admin permissions to some fields, put them in a group labelled "Admin" and the empty Admin group shows up for those users who cannot see the fields in there.

giorgio79’s picture

WorldFallz’s picture

Project: Field Group » Content Construction Kit (CCK)
Version: 7.x-1.x-dev » 6.x-2.x-dev
Component: User interface » fieldgroup.module
Status: Closed (duplicate) » Active

field_group for d7 is a completely different module and as far as I know, this issue still exists for the d6 version of fieldgroup that belongs to cck-- there's no legit reason to move it. Rather you should create a new issue in the new module's issue queue.