You are here

function opigno_moxtra_opigno_moxtra_meeting_insert in Opigno Moxtra 8

Same name and namespace in other branches
  1. 3.x opigno_moxtra.module \opigno_moxtra_opigno_moxtra_meeting_insert()

Implements hook_ENTITY_TYPE_insert().

Updates the calendar event related to the live meeting.

File

./opigno_moxtra.module, line 528
Contains opigno_moxtra.module.

Code

function opigno_moxtra_opigno_moxtra_meeting_insert(EntityInterface $entity) {
  if (!_opigno_moxtra_is_active()) {
    return;
  }

  // Set meeting reference on the related calendar event.

  /** @var \Drupal\opigno_moxtra\MeetingInterface $entity */
  $calendar_event = $entity
    ->getCalendarEvent();
  if (isset($calendar_event)) {
    $calendar_event
      ->set('field_meeting', $entity);
    $calendar_event
      ->save();
  }
}