function sms_requirements in SMS Framework 8
Same name and namespace in other branches
- 2.x sms.install \sms_requirements()
- 2.1.x sms.install \sms_requirements()
Implements hook_requirements().
File
- ./
sms.install, line 13 - Install, update and uninstall functions for SMS Framework.
Code
function sms_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$base_query = \Drupal::entityTypeManager()
->getStorage('sms')
->getQuery();
$query = clone $base_query;
$count = $query
->condition('queued', 0)
->condition('direction', Direction::INCOMING)
->condition('processed', NULL, 'IS NULL')
->count()
->execute();
$requirements['sms_queue_incoming'] = [
'title' => t('SMS incoming queue'),
'severity' => REQUIREMENT_INFO,
'value' => \Drupal::translation()
->formatPlural($count, 'There are @count messages in the incoming queue.', 'There are @count messages in the incoming queue.'),
];
$query = clone $base_query;
$count = $query
->condition('queued', 0)
->condition('direction', Direction::OUTGOING)
->condition('processed', NULL, 'IS NULL')
->count()
->execute();
$requirements['sms_queue_outgoing'] = [
'title' => t('SMS outgoing queue'),
'severity' => REQUIREMENT_INFO,
'value' => \Drupal::translation()
->formatPlural($count, 'There are @count messages in the outgoing queue.', 'There are @count messages in the outgoing queue.'),
];
}
return $requirements;
}