You are here

public function GetAlerts::getActiveAlerts in Site Alert 8

Returns the currently active site alerts.

Return value

\Drupal\site_alert\Entity\SiteAlert[] Array of currently active site alert entities.

Overrides GetAlertsInterface::getActiveAlerts

File

src/GetAlerts.php, line 61

Class

GetAlerts
Service for retrieving site alerts.

Namespace

Drupal\site_alert

Code

public function getActiveAlerts() {
  $ids = $this
    ->getActiveAlertIds();
  if (!empty($ids)) {
    return $this
      ->getStorage()
      ->loadMultiple($ids);
  }
  return [];
}