function social_event_an_enroll_node_presave in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_presave()
- 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_presave()
- 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_presave()
- 10.2.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_presave()
Implements hook_ENTITY_TYPE_presave().
Set the correct value for AN enroll when enroll method is set to request.
File
- modules/
social_features/ social_event/ modules/ social_event_an_enroll/ social_event_an_enroll.module, line 268 - The Social event AN enroll module.
Code
function social_event_an_enroll_node_presave(EntityInterface $entity) {
// If the enroll method is request then anonymous must be off.
if ($entity
->getType() === 'event' && $entity
->get('field_enroll_method')->value === '2') {
$entity
->set('field_event_an_enroll', '0');
}
}