You are here

function opigno_ilt_opigno_ilt_update in Opigno Instructor-led Trainings 8

Same name and namespace in other branches
  1. 3.x opigno_ilt.module \opigno_ilt_opigno_ilt_update()

Implements hook_ENTITY_TYPE_update().

Updates a calendar event related to a instructor-led training.

File

./opigno_ilt.module, line 307
Contains opigno_ilt.module.

Code

function opigno_ilt_opigno_ilt_update(EntityInterface $entity) {

  // Set instructor-led training reference on a related calendar event.

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