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
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\opd_daily_emails\Repository;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
|
||||
final class DailyEmailNodeRepository implements DailyEmailRepositoryInterface {
|
||||
|
||||
public function __construct(
|
||||
public readonly EntityTypeManagerInterface $entityTypeManager,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getAll(): array {
|
||||
$query = $this->entityTypeManager
|
||||
->getStorage('node')
|
||||
->getQuery();
|
||||
|
||||
// TODO: add condition for published status. Only return published nodes.
|
||||
$query->condition('type', 'daily_email');
|
||||
|
||||
$query->accessCheck(TRUE);
|
||||
|
||||
$result = $query->execute();
|
||||
|
||||
// TODO: this returns a list of node IDs. Load and return the nodes.
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\opd_daily_emails\Repository;
|
||||
|
||||
interface DailyEmailRepositoryInterface {
|
||||
|
||||
public function getAll(): array;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue