Completed
Push — master ( 2b3d30...8f3620 )
by Tim
02:08
created

PageTitleViewHelper::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * PageTitleViewHelper.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\ViewHelpers\Backend;
9
10
use HDNET\Calendarize\ViewHelpers\AbstractViewHelper;
11
use TYPO3\CMS\Backend\Utility\BackendUtility;
12
13
/**
14
 * PageTitleViewHelper.
15
 */
16
class PageTitleViewHelper extends AbstractViewHelper
17
{
18
    /**
19
     * Init arguments.
20
     */
21
    public function initializeArguments()
22
    {
23
        parent::initializeArguments();
24
        $this->registerArgument('uid', 'int', 'Page UID', true);
25
    }
26
27
    /**
28
     * Render.
29
     *
30
     * @return string
31
     */
32
    public function render(): string
33
    {
34
        $uid = (int) $this->arguments['uid'];
35
        $record = BackendUtility::getRecord('pages', $uid);
36
37
        return (string) $record['title'];
38
    }
39
}
40