You are here

function field_group_read_groups in Field Group 7

Same name in this branch
  1. 7 field_group.api.php \field_group_read_groups()
  2. 7 field_group.module \field_group_read_groups()
Same name and namespace in other branches
  1. 7.2 field_group.api.php \field_group_read_groups()
  2. 7.2 field_group.module \field_group_read_groups()

Read all groups.

Parameters

array $conditions: Parameters for the query, as elements of the $conditions array. 'entity_type' The name of the entity type. 'bundle' The name of the bundle. 'mode' The view mode.

boolean $enabled: Return enabled or disabled groups.

Return value

array Array of groups.

5 calls to field_group_read_groups()
field_group_exists in ./field_group.module
Checks if a field_group exists in required context.
field_group_field_attach_delete_bundle in ./field_group.module
Implements hook_field_attach_delete_bundle().
field_group_field_ui_clone_field_groups_validate in ./field_group.field_ui.inc
Validate handler to validate saving existing fieldgroups from one view mode or form to another.
field_group_field_ui_create_vertical_tabs in ./field_group.field_ui.inc
Create vertical tabs.
field_group_info_groups in ./field_group.module
Get all groups.

File

./field_group.module, line 1697
Fieldgroup module.

Code

function field_group_read_groups($conditions = array(), $enabled = TRUE) {
  $groups = array();
  ctools_include('export');
  if (empty($conditions)) {
    $records = ctools_export_load_object('field_group');
  }
  else {
    $records = ctools_export_load_object('field_group', 'conditions', $conditions);
  }
  foreach ($records as $group) {

    // Return only enabled groups.
    if ($enabled && isset($group->disabled) && $group->disabled) {
      continue;
    }
    elseif (!$enabled && (!isset($group->disabled) || !$group->disabled)) {
      continue;
    }
    $groups[$group->entity_type][$group->bundle][$group->mode][$group->group_name] = field_group_unpack($group);
  }
  drupal_alter('field_group_info', $groups);
  return $groups;
}