You are here

function multiple_registration_field_group_pre_render in Multiple Registration 7

Implements hook_field_group_pre_render().

File

./multiple_registration.module, line 475
Add ability to create several registration pages.

Code

function multiple_registration_field_group_pre_render(&$element, $group, &$form) {
  $group_children = isset($group->children) ? $group->children : array();
  foreach ($group_children as $id => $field_name) {
    $instance = field_info_instance('user', $field_name, 'user');

    // Field is not accesible by user role.
    if (is_array($instance) && !multiple_registration_is_field_accessible($instance)) {
      unset($group_children[$id]);
    }
  }

  // If all fields from group are not accessible, hide this group.
  if (empty($group_children)) {
    field_group_hide_field_groups($form, array(
      $group->group_name,
    ));
  }
}