You are here

function field_group_get_content_element_key in Field Group 8.3

Same name and namespace in other branches
  1. 8 field_group.module \field_group_get_content_element_key()

Provides the content element key for a display context.

This allows entity modules to specify their content element for field group support, or other modules to add entity module support.

Parameters

$context: The display context (entity type, form or view).

Return value

string

3 calls to field_group_get_content_element_key()
field_group_build_entity_groups in ./field_group.module
Pre-render callback for entity views.
field_group_fields_nest in ./field_group.module
Nests all the fields in the field groups.
field_group_field_layout_fields_nest in ./field_group.module
Nests all the fields in the field groups.

File

./field_group.module, line 847
Allows administrators to attach field groups.

Code

function field_group_get_content_element_key($context = 'default') {
  $keys =& drupal_static('field_group_content_elements');
  if (!isset($keys)) {
    $keys['default'] = 'content';

    // Allow other modules to alter the array.
    Drupal::moduleHandler()
      ->alter('field_group_content_element_keys', $keys);
  }

  // Check if we have a specific content element key for this entity type.
  $key = $keys['default'];
  if (isset($keys[$context])) {
    $key = $keys[$context];
  }
  return $key;
}