function opigno_ilt_opigno_ilt_insert in Opigno Instructor-led Trainings 8
Same name and namespace in other branches
- 3.x opigno_ilt.module \opigno_ilt_opigno_ilt_insert()
Implements hook_ENTITY_TYPE_insert().
Updates a calendar event related to a instructor-led training.
File
- ./
opigno_ilt.module, line 248 - Contains opigno_ilt.module.
Code
function opigno_ilt_opigno_ilt_insert(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();
}
}