protected function EnrollActionForm::eventHasBeenFinished in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.2 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.3 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.4 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.5 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.6 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.7 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 8.8 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 10.3.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 10.0.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 10.1.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
- 10.2.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
Function to determine if an event has been finished.
Parameters
\Drupal\node\Entity\Node $node: The event.
Return value
bool TRUE if the evens is finished / completed.
1 call to EnrollActionForm::eventHasBeenFinished()
- EnrollActionForm::buildForm in modules/
social_features/ social_event/ src/ Form/ EnrollActionForm.php - Form constructor.
File
- modules/
social_features/ social_event/ src/ Form/ EnrollActionForm.php, line 238
Class
- EnrollActionForm
- Class EnrollActionForm.
Namespace
Drupal\social_event\FormCode
protected function eventHasBeenFinished(Node $node) {
// Use the start date when the end date is not set to determine if the
// event is closed.
/** @var \Drupal\Core\Datetime\DrupalDateTime $check_end_date */
$check_end_date = $node->field_event_date->date;
if (isset($node->field_event_date_end->date)) {
$check_end_date = $node->field_event_date_end->date;
}
$current_time = new DrupalDateTime();
// The event has finished if the end date is smaller than the current date.
if ($current_time > $check_end_date) {
return TRUE;
}
return FALSE;
}