public function SiteAlert::isCurrentlyScheduled in Site Alert 8
File
- src/
Entity/ SiteAlert.php, line 118
Class
- SiteAlert
- Implements SiteAlert class.
Namespace
Drupal\site_alert\EntityCode
public function isCurrentlyScheduled() {
$now = new DrupalDateTime();
if ($start_time = $this
->get('scheduling')->value) {
$date = new DrupalDateTime($start_time, 'UTC');
if ($now < $date) {
return FALSE;
}
}
if ($end_time = $this
->get('scheduling')->end_value) {
$date = new DrupalDateTime($end_time, 'UTC');
if ($now > $date) {
return FALSE;
}
}
return TRUE;
}