You are here

protected function EnrollActionForm::eventHasBeenFinished in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  2. 8 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  3. 8.2 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  4. 8.3 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  5. 8.4 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  6. 8.5 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  7. 8.6 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  8. 8.7 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  9. 8.8 modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  10. 10.3.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  11. 10.0.x modules/social_features/social_event/src/Form/EnrollActionForm.php \Drupal\social_event\Form\EnrollActionForm::eventHasBeenFinished()
  12. 10.1.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.

3 calls to EnrollActionForm::eventHasBeenFinished()
EnrollActionForm::buildForm in modules/social_features/social_event/src/Form/EnrollActionForm.php
Form constructor.
EventAnEnrollActionForm::buildForm in modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollActionForm.php
Form constructor.
EventAnEnrollForm::buildForm in modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollForm.php
Form constructor.

File

modules/social_features/social_event/src/Form/EnrollActionForm.php, line 366

Class

EnrollActionForm
Class EnrollActionForm.

Namespace

Drupal\social_event\Form

Code

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;
}