Only load published nodes

This commit is contained in:
Oliver Davies 2024-01-17 10:57:40 +00:00
parent 529eb1458e
commit 7714b20d3c

View file

@ -17,7 +17,9 @@ final class PostNodeRepository {
*/
public function findAll(): array {
$nodeStorage = $this->entityTypeManager->getStorage('node');
$nodes = $nodeStorage->loadMultiple();
$nodes = $nodeStorage->loadByProperties([
'status' => TRUE,
]);
uasort($nodes, function (NodeInterface $a, NodeInterface $b): int {
return $a->getCreatedTime() <=> $b->getCreatedTime();