diff --git a/modules/opd_daily_emails/opd_daily_emails.module b/modules/opd_daily_emails/opd_daily_emails.module index c780de12e..13fcc8067 100644 --- a/modules/opd_daily_emails/opd_daily_emails.module +++ b/modules/opd_daily_emails/opd_daily_emails.module @@ -3,6 +3,7 @@ declare(strict_types=1); use Drupal\Core\Render\BubbleableMetadata; +use Drupal\opd_daily_emails\Collection\DailyEmailCollection; use Drupal\opd_daily_emails\Repository\DailyEmailNodeRepository; /** @@ -43,7 +44,9 @@ function opd_daily_emails_tokens($type, $tokens, array $data, array $options, Bu case 'email-count': $dailyEmailRepository = \Drupal::service(DailyEmailNodeRepository::class); - $replacements[$original] = count($dailyEmailRepository->getAll()); + $dailyEmails = $dailyEmailRepository->getAll(); + + $replacements[$original] = $dailyEmails->count(); break; } }