You are here

function field_group_info_groups in Field Group 8

Same name and namespace in other branches
  1. 8.3 field_group.module \field_group_info_groups()
  2. 7.2 field_group.api.php \field_group_info_groups()
  3. 7.2 field_group.module \field_group_info_groups()
  4. 7 field_group.api.php \field_group_info_groups()
  5. 7 field_group.module \field_group_info_groups()

Get all groups.

Parameters

$entity_type: The name of the entity.

$bundle: The name of the bundle.

$context: The context of the view mode (form or view)

$mode: The view mode.

6 calls to field_group_info_groups()
field_group_attach_groups in ./field_group.module
Attach groups to the (form) build.
field_group_field_info_max_weight in ./field_group.module
Implements hook_field_info_max_weight().
field_group_field_overview_submit in includes/field_ui.inc
Submit handler for the overview screens.
field_group_field_ui_clone_field_groups_validate in includes/field_ui.inc
Validate handler to validate saving existing fieldgroups from one view mode or form to another.
field_group_field_ui_form_params in includes/field_ui.inc
Helper function to get the form parameters to use while building the fields and display overview form.

... See full list

File

./field_group.module, line 666
Allows administrators to attach custom fields to fieldable types.

Code

function field_group_info_groups($entity_type, $bundle, $context, $mode) {
  if ($context == 'form') {
    $display = EntityFormDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
    if (!$display) {
      return array();
    }
    $data = $display
      ->getThirdPartySettings('field_group');
  }
  if ($context == 'view') {
    $display = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
    if (!$display) {
      return array();
    }
    $data = $display
      ->getThirdPartySettings('field_group');
  }
  $groups = array();
  if (isset($data) && is_array($data)) {
    foreach ($data as $group_name => $definition) {
      $definition += array(
        'group_name' => $group_name,
        'entity_type' => $entity_type,
        'bundle' => $bundle,
        'context' => $context,
        'mode' => $mode,
      );
      $groups[$group_name] = (object) $definition;
    }
  }
  return $groups;
}