You are here

protected function CalendarEventEmbeddedWidget::attachFieldGroups in Opigno calendar event 8

Same name in this branch
  1. 8 src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::attachFieldGroups()
  2. 8 src/Form/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\Form\CalendarEventEmbeddedWidget::attachFieldGroups()
Same name and namespace in other branches
  1. 3.x src/CalendarEventEmbeddedWidget.php \Drupal\opigno_calendar_event\CalendarEventEmbeddedWidget::attachFieldGroups()

Attaches field groups to the specified subform element.

Parameters

array $element: The subform element.

\Drupal\opigno_calendar_event\CalendarEventInterface $entity: The calendar event entity.

\Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display: A form display object.

1 call to CalendarEventEmbeddedWidget::attachFieldGroups()
CalendarEventEmbeddedWidget::alterForm in src/CalendarEventEmbeddedWidget.php
Alters the parent form.

File

src/CalendarEventEmbeddedWidget.php, line 134

Class

CalendarEventEmbeddedWidget
Provides a widget to attach a calendar event to an entity.

Namespace

Drupal\opigno_calendar_event

Code

protected function attachFieldGroups(array &$element, CalendarEventInterface $entity, EntityFormDisplayInterface $form_display) {
  if (!function_exists('field_group_attach_groups')) {
    return;
  }
  $context = [
    'entity_type' => $entity
      ->getEntityTypeId(),
    'bundle' => $entity
      ->bundle(),
    'entity' => $entity,
    'context' => 'form',
    'display_context' => 'form',
    'mode' => $form_display
      ->getMode(),
  ];
  field_group_attach_groups($element, $context);
  $element['#pre_render'][] = 'field_group_form_pre_render';
}