public function GetAlerts::getActiveAlertIds in Site Alert 8
Returns the entity IDs of the currently active site alerts.
Return value
array Array of currently active site alert entity IDs.
Overrides GetAlertsInterface::getActiveAlertIds
1 call to GetAlerts::getActiveAlertIds()
- GetAlerts::getActiveAlerts in src/
GetAlerts.php - Returns the currently active site alerts.
File
- src/
GetAlerts.php, line 35
Class
- GetAlerts
- Service for retrieving site alerts.
Namespace
Drupal\site_alertCode
public function getActiveAlertIds() {
$now = $this
->dateNow();
$query = $this
->getStorage()
->getQuery();
$start_value = $query
->orConditionGroup()
->condition('scheduling.value', $now, '<=')
->notExists('scheduling.value');
$end_value = $query
->orConditionGroup()
->condition('scheduling.end_value', $now, '>')
->notExists('scheduling.end_value');
$query
->condition('active', 1, '=')
->condition($start_value)
->condition($end_value);
return $query
->execute();
}