Passed
Push — main ( f98caf...46400b )
by Torben
71:32 queued 29:51
created

TitleViewHelper::getTypoScriptFrontendController()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Rendering\RenderingContextInterface;
17
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
18
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
19
20
/**
21
 * ViewHelper to render the page title and indexed search title
22
 */
23
class TitleViewHelper extends AbstractViewHelper
24
{
25
    use CompileWithRenderStatic;
26
27
    public function initializeArguments(): void
28
    {
29
        parent::initializeArguments();
30
        $this->registerArgument('pageTitle', 'String', 'The page title');
31
    }
32
33
    public static function renderStatic(
34
        array $arguments,
35
        \Closure $renderChildrenClosure,
36
        RenderingContextInterface $renderingContext
37
    ) {
38
        $pageTitle = $arguments['pageTitle'] ?? '';
39
        if ($pageTitle !== '') {
40
            GeneralUtility::makeInstance(EventPageTitleProvider::class)->setTitle($pageTitle);
41
        }
42
    }
43
}
44