2

I worked out a way to hide fields with field permission module on registration. But have not found a way to hide whole field groups. Is there a module or a particular API which can help with this problem.

3

you can do this with using hook_form_alter

You can do something like this:

function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
    if($form_id == 'your_form_name') {
        //do what ever you want
        //$form is an array of form elements, to delete some of them you can just do:
        unset($form['your-element-name']);
        //or and I think it is more "drupal way" to do things you can hide an element using hide function, e.g.:
        hide($form['account']);
    }
}
| improve this answer | |
0

You can try the following simple code:

field_group_hide_field_groups($form, array('group_advert_hidden'));

in hook_form_alter() or similar place.

In example:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function foo_form_user_register_form_alter(&$form, &$form_state, $form_id) {
    field_group_hide_field_groups($form, array('group_advert_hidden'));
}

Eventually you may try to use Conditional Fields module to hide the fields, so empty group would be hidden, as hiding field group are not supported yet.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.