I would like to be able to hide fieldgroups, vertical tabs, etc.. for forms where a user has insufficient access to view/edit/update a given field. This is particularly useful for placing administrative or role specific groups into a single group. If the user should not see the contents of the group, resulting in a fieldless group, then keep the user-interface as clean and as simple as possible by not showing that group.

I can see a use case for always showing a field group as well, such as wanting to always show the description of a given field group.

This is a feature request to do this conditionally.
That is, a user creating a given field group should be able to select a checkbox, such as "Show even if no fields are visible".

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stalski’s picture

Status: Active » Postponed (maintainer needs more info)

I don't see any real life case in here. And if it would be one, I can't imagine that it's common. Currently when no allowed fields are shown, the wrapping field_group will not be shown. So your request is that a group "prohibited content" needs to shown for a user who does not have access to a textarea?

I also don't know what you mean by "a user creating a given field group"? Most of the time this is the admin(istrator) job, no?

Maybe you can explain best with your real life example.

thekevinday’s picture

"That is, a user creating a given field group should be able to select a checkbox, such as "Show even if no fields are visible"."
Is simply a restatement of the request.

I would like to have a checkbox in the administration interface to enable or disable showing of a given field group when that group has no visible content.

Example form fields:
- [field: title] (access = admin, users in roles A, B, C)
- [field: body] (access = admin, users in roles A, B, C)
- [field_group: Workflow (vertical tab)] (access = all)
-- [field: Workflow Property A] = (access = admin, users in role A)
-- [field: Workflow Property B] = (access = admin, users in role B)

If the user has the role A and is not an admin user, then they currently see:
- [field: title]
- [field: body]
- [field_group: Workflow (vertical tab)]
-- [field: Workflow Property A]

If the user has the role C and is not an admin user, then they currently see:
- [field: title]
- [field: body]
- [field_group: Workflow (vertical tab)]

The conditions would be that if workflow has no visible content, the user in role C should see:
- [field: title]
- [field: body]

Unfortunately (for me), I have forms that have 10->100's of fields.
Field groups are used to help structure and make sense of those fields.
Vertical tabs help simplify things, but with a large quantity of fields it still makes sense to want to trim away as many of those field groups as possible.
This should be easy if a given group has no visible fields.

haggan’s picture

I am also interested in this kind of use case.
I would like to hide the field group if no field are visible.

jrochate’s picture

I also agree with OP:

"That is, a user creating a given field group should be able to select a checkbox, such as "Show even if no fields are visible"."

The default behavior would be what the module does: hidden when no content.
But that situation could be overridden with such condition (suggested OP checkbox)

giorgio79’s picture

Status: Postponed (maintainer needs more info) » Active

Looks like this was a problem in the old CCK d6 as well #277101: Hide Group when all fields empty

I am using http://drupal.org/project/field_permissions and created an Admin group for admin only fields. Now, non admins can see an empty admin group.

WorldFallz’s picture

this is actually exactly the opposite issue-- that the field group should show when the user doesn't have access to the fields. Also, i just tested this with field_group-7.x-dev and the field group doesn't show when the user doesn't see any of the fields.

ezman’s picture

I've found it would be useful to have the option to display empty field groups.

While building a multi-user site with heavily customised node add/edit forms, I've tried to use Field Group to place an empty div element in the form (for use as a preview area which updates with AJAX when a node is added to an Entity Reference field), so that my javascript has something that it can refer to with a single clean class name, rather than traversing nodes and using jQuery.find().

Of course it's nothing that I haven't been able to work around with form API hooks, but it would be nice to have a checkbox to allow showing empty field groups.

james.williams’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

sibopa made their first commit to this issue’s fork.