You are here

function field_group_get_content_element_key in Field Group 8

Same name and namespace in other branches
  1. 8.3 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).

2 calls to field_group_get_content_element_key()
field_group_build_entity_groups in ./field_group.module
Preprocess/ Pre-render callback.
field_group_fields_nest in ./field_group.module
Recursive function to nest fields in the field groups.

File

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

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;
}