Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #109 from apility/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
thomas-alrek authored Nov 26, 2019
2 parents 40cde58 + 19443bf commit 3466be0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
28 changes: 12 additions & 16 deletions src/functions/common/functions_pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,21 @@ function get_full_content_array($page_id)
$contentItems = json_decode(NF::$capi->get('builder/pages/' . $page_id . '/content')->getBody(), true);

foreach ($contentItems as $item) {
if (isset($content[$item['area']])) {
$existing = $content[$item['area']];
$content[$item['area']] = null;
$content[$item['area']] = [];
$content[$item['area']][] = $existing;

if (!isset($content[$item['area']][0])) {
$existing = $content[$item['area']];
$content[$item['area']] = null;
$content[$item['area']] = [];
$content[$item['area']][] = $existing;
if ($item['published']) {
if (isset($content[$item['area']])) {
if (!isset($content[$item['area']][0])) {
$existing = $content[$item['area']];
$content[$item['area']] = null;
$content[$item['area']] = [];
$content[$item['area']][] = $existing;
}
$content[$item['area']][] = $item;
} else {
$content[$item['area']] = $item;
}

$content[$item['area']][] = $item;
} else {
$content[$item['area']] = $item;
$content['id_' . $item['id']] = $item;
}

$content['id_' . $item['id']] = $item;
}

NF::$cache->save('page/' . $page_id, $content);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<body><h1>Test component [display_page_blocks]</h1>
<h1>Test component [display_page_blocks]</h1></body></html>
<body><h1>Test component [display_page_blocks]</h1></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function testOutputsMatchesSnapshot(): void
'sorting' => null,
'name' => 'Test 1',
'title' => 'nfabcdefghijklmno1',
'text' => 1
'text' => 1,
'published' => 1
],
[
'id' => 2,
Expand All @@ -39,7 +40,8 @@ public function testOutputsMatchesSnapshot(): void
'sorting' => null,
'name' => 'Test 2',
'title' => 'nfabcdefghijklmno2',
'text' => 1
'text' => 1,
'published' => 0
]
]
))
Expand Down

0 comments on commit 3466be0

Please sign in to comment.