Passed
Push — main ( 52a7ec...5410b3 )
by Torben
03:32
created

TitleViewHelper::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\ViewHelpers;
13
14
use DERHANSEN\SfEventMgt\PageTitle\EventPageTitleProvider;
15
use TYPO3\CMS\Core\Utility\GeneralUtility;
16
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
17
18
/**
19
 * ViewHelper to render the page title and indexed search title
20
 */
21
class TitleViewHelper extends AbstractViewHelper
22
{
23
    public function initializeArguments(): void
24
    {
25
        parent::initializeArguments();
26
        $this->registerArgument('pageTitle', 'String', 'The page title');
27
    }
28
29
    public function render(): void
30
    {
31
        $pageTitle = $this->arguments['pageTitle'] ?? '';
32
        if ($pageTitle !== '') {
33
            GeneralUtility::makeInstance(EventPageTitleProvider::class)->setTitle($pageTitle);
34
        }
35
    }
36
}
37