public function EventMaxEnrollService::isEnabled in Open Social 8.9
Same name and namespace in other branches
- 8.5 modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 8.6 modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 8.7 modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 8.8 modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 10.3.x modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 10.0.x modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 10.1.x modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
- 10.2.x modules/social_features/social_event/modules/social_event_max_enroll/src/Service/EventMaxEnrollService.php \Drupal\social_event_max_enroll\Service\EventMaxEnrollService::isEnabled()
Check if anonymous enrollment is allowed for given event.
Parameters
\Drupal\node\NodeInterface $node: The node to check for.
Return value
bool Returns TRUE if feature is enabled, the node is an event and max enroll is configured.
Overrides EventMaxEnrollServiceInterface::isEnabled
File
- modules/
social_features/ social_event/ modules/ social_event_max_enroll/ src/ Service/ EventMaxEnrollService.php, line 88
Class
- EventMaxEnrollService
- Class EventMaxEnrollService.
Namespace
Drupal\social_event_max_enroll\ServiceCode
public function isEnabled(NodeInterface $node) {
// Check if we're working with an event.
if ($this->socialEventEnroll
->isEnabled($node)) {
$config = $this->configFactory
->get('social_event_max_enroll.settings');
// Check if feature is enabled.
if ($config
->get('max_enroll')) {
// Get enrollment configuration for this event.
$is_event_max_enroll = !$node->field_event_max_enroll
->isEmpty() && $node->field_event_max_enroll->value;
$is_event_max_enroll_num = !$node->field_event_max_enroll_num
->isEmpty();
return $is_event_max_enroll && $is_event_max_enroll_num;
}
}
return FALSE;
}