Skip to content

Commit 7373d1d

Browse files
authored
Fetch non-published items when building hierarchy
This fixes the discrepancy when building as an admin or from public. The unpublished items may sometimes interfere with the route generation.
1 parent 1771c59 commit 7373d1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Service/HierarchicalRoutesService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private function importMenuItem($item, $parent = null)
276276
$content = false;
277277
if (isset($item['path']) && $item['path'] != 'homepage') {
278278
/** @var \Bolt\Legacy\Content $content */
279-
$content = $this->storage->getContent($item['path'], ['hydrate' => false]);
279+
$content = $this->storage->getContent($item['path'], ['hydrate' => false, 'status' => '!']);
280280
}
281281

282282
// Only items with records can be in a hierarchy, otherwise it doesn't make much sense
@@ -361,7 +361,7 @@ private function importRules(array $rules)
361361
*/
362362
private function importRule($type, $params)
363363
{
364-
$content = $this->storage->getContent($params['parent'], ['hydrate' => false]);
364+
$content = $this->storage->getContent($params['parent'], ['hydrate' => false, 'status' => '!']);
365365

366366
switch ($type) {
367367
case 'contenttype':
@@ -522,7 +522,7 @@ public function getSiblings($record)
522522
private function hydrateRecord($item)
523523
{
524524
if ($item) {
525-
return $this->storage->getContent($item);
525+
return $this->storage->getContent($item, ['status' => '!']);
526526
} else {
527527
return $item; // or null
528528
}

0 commit comments

Comments
 (0)