Showing
2 changed files
with
5 additions
and
5 deletions
| ... | @@ -836,18 +836,18 @@ class EntityRepo | ... | @@ -836,18 +836,18 @@ class EntityRepo |
| 836 | /** | 836 | /** |
| 837 | * Parse the headers on the page to get a navigation menu | 837 | * Parse the headers on the page to get a navigation menu |
| 838 | * @param Page $page | 838 | * @param Page $page |
| 839 | - * @return Collection | 839 | + * @return array |
| 840 | */ | 840 | */ |
| 841 | public function getPageNav(Page $page) | 841 | public function getPageNav(Page $page) |
| 842 | { | 842 | { |
| 843 | - if ($page->html == '') return null; | 843 | + if ($page->html == '') return []; |
| 844 | libxml_use_internal_errors(true); | 844 | libxml_use_internal_errors(true); |
| 845 | $doc = new DOMDocument(); | 845 | $doc = new DOMDocument(); |
| 846 | $doc->loadHTML(mb_convert_encoding($page->html, 'HTML-ENTITIES', 'UTF-8')); | 846 | $doc->loadHTML(mb_convert_encoding($page->html, 'HTML-ENTITIES', 'UTF-8')); |
| 847 | $xPath = new DOMXPath($doc); | 847 | $xPath = new DOMXPath($doc); |
| 848 | $headers = $xPath->query("//h1|//h2|//h3|//h4|//h5|//h6"); | 848 | $headers = $xPath->query("//h1|//h2|//h3|//h4|//h5|//h6"); |
| 849 | 849 | ||
| 850 | - if (is_null($headers)) return null; | 850 | + if (is_null($headers)) return []; |
| 851 | 851 | ||
| 852 | $tree = collect([]); | 852 | $tree = collect([]); |
| 853 | foreach ($headers as $header) { | 853 | foreach ($headers as $header) { |
| ... | @@ -868,7 +868,7 @@ class EntityRepo | ... | @@ -868,7 +868,7 @@ class EntityRepo |
| 868 | return $header; | 868 | return $header; |
| 869 | }); | 869 | }); |
| 870 | } | 870 | } |
| 871 | - return $tree; | 871 | + return $tree->toArray(); |
| 872 | } | 872 | } |
| 873 | 873 | ||
| 874 | /** | 874 | /** | ... | ... |
| ... | @@ -26,7 +26,7 @@ | ... | @@ -26,7 +26,7 @@ |
| 26 | @endforeach | 26 | @endforeach |
| 27 | @endif | 27 | @endif |
| 28 | 28 | ||
| 29 | - @if (isset($pageNav) && $pageNav) | 29 | + @if (isset($pageNav) && count($pageNav)) |
| 30 | <h6 class="text-muted">{{ trans('entities.pages_navigation') }}</h6> | 30 | <h6 class="text-muted">{{ trans('entities.pages_navigation') }}</h6> |
| 31 | <div class="sidebar-page-nav menu"> | 31 | <div class="sidebar-page-nav menu"> |
| 32 | @foreach($pageNav as $navItem) | 32 | @foreach($pageNav as $navItem) | ... | ... |
-
Please register or sign in to post a comment