public function SocialEventEnrollService::isEnabled in Open Social 8.7
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 8.5 modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 8.6 modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 8.8 modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 10.3.x modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 10.0.x modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 10.1.x modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
- 10.2.x modules/social_features/social_event/src/Service/SocialEventEnrollService.php \Drupal\social_event\Service\SocialEventEnrollService::isEnabled()
Check if enrollment is allowed for given event.
Parameters
\Drupal\node\NodeInterface $node: A node.
Return value
bool TRUE if enrollment is allowed.
Overrides SocialEventEnrollServiceInterface::isEnabled
File
- modules/
social_features/ social_event/ src/ Service/ SocialEventEnrollService.php, line 17
Class
- SocialEventEnrollService
- Class SocialEventEnrollService.
Namespace
Drupal\social_event\ServiceCode
public function isEnabled(NodeInterface $node) {
if ($node
->bundle() === 'event' && $node
->hasField('field_event_enroll')) {
$was_not_changed = $node->field_event_enroll
->isEmpty();
$is_enabled = $node->field_event_enroll->value;
return $was_not_changed || $is_enabled;
}
return FALSE;
}