• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / vhs / 30001290505

23 Jul 2026 10:57AM UTC coverage: 70.309% (-1.7%) from 72.022%
30001290505

push

github

NamelessCoder
[TER] 8.0.0

4819 of 6854 relevant lines covered (70.31%)

6.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.48
/Classes/ViewHelpers/Page/BreadCrumbViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Page;
3

4
/*
5
 * This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Vhs\Traits\ArgumentOverride;
12
use FluidTYPO3\Vhs\ViewHelpers\Menu\AbstractMenuViewHelper;
13
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
14

15
/**
16
 * ViewHelper to make a breadcrumb link set from a pageUid, automatic or manual.
17
 */
18
class BreadCrumbViewHelper extends AbstractMenuViewHelper
19
{
20
    use ArgumentOverride;
21

22
    public function initializeArguments(): void
23
    {
24
        parent::initializeArguments();
3✔
25
        $this->registerArgument(
3✔
26
            'pageUid',
3✔
27
            'integer',
3✔
28
            'Optional parent page UID to use as top level of menu. If left out will be detected from ' .
3✔
29
            'rootLine using $entryLevel.'
3✔
30
        );
3✔
31
        $this->registerArgument(
3✔
32
            'endLevel',
3✔
33
            'integer',
3✔
34
            'Optional deepest level of rendering. If left out all levels up to the current are rendered.'
3✔
35
        );
3✔
36
        $this->overrideArgument(
3✔
37
            'as',
3✔
38
            'string',
3✔
39
            'If used, stores the menu pages as an array in a variable named after this value and renders the tag ' .
3✔
40
            'content. If the tag content is empty automatic rendering is triggered.',
3✔
41
            false,
3✔
42
            'breadcrumb'
3✔
43
        );
3✔
44
    }
45

46
    public function render(): string
47
    {
48
        $pageUid = $this->arguments['pageUid'] > 0 ? $this->arguments['pageUid'] : $GLOBALS['TSFE']->id;
×
49
        /** @var int $entryLevel */
50
        $entryLevel = $this->arguments['entryLevel'];
×
51
        /** @var int|null $endLevel */
52
        $endLevel = $this->arguments['endLevel'];
×
53
        $rawRootLineData = $this->pageService->getRootLine($pageUid);
×
54
        $rawRootLineData = array_reverse($rawRootLineData);
×
55
        $rawRootLineData = array_slice($rawRootLineData, $entryLevel, $endLevel);
×
56
        $rootLineData = [];
×
57
        $showHidden = (bool) $this->arguments['showHiddenInMenu'];
×
58
        $spacerDoktype = PageRepository::DOKTYPE_SPACER;
×
59
        foreach ($rawRootLineData as $record) {
×
60
            $isHidden = (bool) $record['nav_hide'];
×
61

62
            if ($this->arguments['includeSpacers']) {
×
63
                $isAllowedDoktype = (int) $record['doktype'] <= $spacerDoktype;
×
64
            } else {
65
                $isAllowedDoktype = (int) $record['doktype'] < $spacerDoktype;
×
66
            }
67

68
            if (($showHidden && $isHidden || !$isHidden) && $isAllowedDoktype) {
×
69
                $rootLineData[] = $record;
×
70
            }
71
        }
72
        $rootLine = $this->parseMenu($rootLineData);
×
73
        if (0 === count($rootLine)) {
×
74
            return '';
×
75
        }
76
        $this->backupVariables();
×
77
        /** @var string $as */
78
        $as = $this->arguments['as'];
×
79
        $this->renderingContext->getVariableProvider()->add($as, $rootLine);
×
80
        $output = $this->renderContent($rootLine);
×
81
        $this->renderingContext->getVariableProvider()->remove($as);
×
82
        $this->restoreVariables();
×
83

84
        return $output;
×
85
    }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc