Skip to content

Commit

Permalink
Merge branch 'develop' into block-groups-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsafley committed Feb 6, 2024
2 parents 968a684 + b9be44a commit 120a656
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions application/src/Site/BlockLayout/ListOfPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ public function form(PhpRenderer $view, SiteRepresentation $site,
$pageList = new Hidden("o:block[__blockIndex__][o:data][pagelist]");
if ($block) {
$nodes = json_decode($block->dataValue('pagelist'), true);
$nodes = is_array($nodes) ? $nodes : [];
$pageTree = $this->getPageNodeURLs($nodes, $block);
} else {
$pageTree = '';
}
$pageList->setValue(json_encode($pageTree));

$html = '<div class="block-pagelist-tree"';
$html .= '" data-jstree-data="' . $escape($pageList->getValue());
$html .= '"></div>';
$html .= '<button type="button" class="site-page-add">';
$html .= $view->translate('Add pages') . '</button>';
$html = '<div class="block-pagelist-tree" data-jstree-data="' . $escape($pageList->getValue()) . '"></div>';
$html .= '<button type="button" class="site-page-add">' . $view->translate('Add pages') . '</button>';
$html .= '<div class="inputs">' . $view->formRow($pageList) . '</div>';

return $html;
Expand All @@ -66,7 +64,7 @@ public function form(PhpRenderer $view, SiteRepresentation $site,
public function render(PhpRenderer $view, SitePageBlockRepresentation $block, $templateViewScript = 'common/block-layout/list-of-pages')
{
$nodes = json_decode($block->dataValue('pagelist'), true);
if (!$nodes) {
if (!is_array($nodes)) {
return '';
}

Expand Down

0 comments on commit 120a656

Please sign in to comment.