You are here

function field_group_inline_entity_form_entity_form_alter in Field Group 8

Same name and namespace in other branches
  1. 8.3 field_group.module \field_group_inline_entity_form_entity_form_alter()

Implements hook_inline_entity_form_entity_form_alter().

File

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

Code

function field_group_inline_entity_form_entity_form_alter(&$entity_form, FormStateInterface $form_state) {

  // Attach the fieldgroups to current entity form.
  $context = [
    'entity_type' => $entity_form['#entity']
      ->getEntityTypeId(),
    'bundle' => $entity_form['#entity']
      ->bundle(),
    'entity' => $entity_form['#entity'],
    'display_context' => 'form',
    'mode' => isset($entity_form['#form_mode']) ? $entity_form['#form_mode'] : 'default',
  ];
  field_group_attach_groups($entity_form, $context);
  $entity_form['#pre_render'][] = 'field_group_form_pre_render';
}