function opigno_learning_path_user_module_status_presave in Opigno Learning path 8
Same name and namespace in other branches
- 3.x opigno_learning_path.module \opigno_learning_path_user_module_status_presave()
Implements hook_ENTITY_TYPE_presave().
File
- ./
opigno_learning_path.module, line 2511 - Contains opigno_learning_path.module.
Code
function opigno_learning_path_user_module_status_presave(UserModuleStatus $attempt) {
if ($attempt
->isNew()) {
$gid = OpignoGroupContext::getCurrentGroupId();
$learning_path = isset($gid) ? Group::load($gid) : NULL;
if ($learning_path) {
$attempt
->set('learning_path', $learning_path);
}
}
}