Use the count
method on the Collection
This commit is contained in:
parent
1013305d38
commit
58740872fa
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue