Make the email count dynamic based on the number
...of daily email nodes
This commit is contained in:
parent
6ba4b80645
commit
c48f8acd4a
9 changed files with 5666 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
use Drupal\opd_daily_emails\Repository\DailyEmailNodeRepository;
|
||||
|
||||
/**
|
||||
* Implements hook_token_info().
|
||||
|
@ -40,7 +41,9 @@ function opd_daily_emails_tokens($type, $tokens, array $data, array $options, Bu
|
|||
foreach ($tokens as $name => $original) {
|
||||
switch ($name) {
|
||||
case 'email-count':
|
||||
$replacements[$original] = 822;
|
||||
$dailyEmailRepository = \Drupal::service(DailyEmailNodeRepository::class);
|
||||
|
||||
$replacements[$original] = count($dailyEmailRepository->getAll());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue