function social_event_an_enroll_node_update in Open Social 10.2.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_update()
- 8.3 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 8.4 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 8.5 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 8.6 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 8.7 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 8.8 modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 10.3.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
- 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.module \social_event_an_enroll_node_update()
Implements hook_ENTITY_TYPE_update().
Display warning if visibility was changed for already enabled AN enroll.
File
- modules/
social_features/ social_event/ modules/ social_event_an_enroll/ social_event_an_enroll.module, line 251 - The Social event AN enroll module.
Code
function social_event_an_enroll_node_update(Node $node) {
if ($node
->getType() === 'event') {
$is_event_an_enroll = !empty($node
->get('field_event_an_enroll')->value);
$new_visibility = $node
->get('field_content_visibility')
->getString();
$old_visibility = $node->original
->get('field_content_visibility')
->getString();
if ($is_event_an_enroll && $old_visibility === 'public' && $new_visibility !== 'public') {
\Drupal::messenger()
->addWarning(t('Enrollment without account can only be enabled when the visibility of the event is Public.'));
}
}
}