Only load published nodes
This commit is contained in:
parent
529eb1458e
commit
7714b20d3c
|
@ -17,7 +17,9 @@ final class PostNodeRepository {
|
||||||
*/
|
*/
|
||||||
public function findAll(): array {
|
public function findAll(): array {
|
||||||
$nodeStorage = $this->entityTypeManager->getStorage('node');
|
$nodeStorage = $this->entityTypeManager->getStorage('node');
|
||||||
$nodes = $nodeStorage->loadMultiple();
|
$nodes = $nodeStorage->loadByProperties([
|
||||||
|
'status' => TRUE,
|
||||||
|
]);
|
||||||
|
|
||||||
uasort($nodes, function (NodeInterface $a, NodeInterface $b): int {
|
uasort($nodes, function (NodeInterface $a, NodeInterface $b): int {
|
||||||
return $a->getCreatedTime() <=> $b->getCreatedTime();
|
return $a->getCreatedTime() <=> $b->getCreatedTime();
|
||||||
|
|
Loading…
Reference in a new issue