You are here

public function SitewideAlertManager::nextScheduledChange in Sitewide Alert 8

The time of the next scheduled change of alerts.

Return value

\Drupal\Core\Datetime\DrupalDateTime|null Time of next scheduled change of alerts; null if nothing is scheduled to change.

File

src/SitewideAlertManager.php, line 92

Class

SitewideAlertManager

Namespace

Drupal\sitewide_alert

Code

public function nextScheduledChange() {
  $nextExpiring = $this
    ->soonestExpiringVisibleScheduledAlertDateTime();
  $nextShowing = $this
    ->soonestAppearingScheduledAlertDateTime();
  if ($nextExpiring && $nextShowing) {
    return $nextShowing > $nextExpiring ? $nextExpiring : $nextShowing;
  }
  if ($nextShowing) {
    return $nextShowing;
  }
  if ($nextExpiring) {
    return $nextExpiring;
  }
  return NULL;
}