Completed
Push — master ( cb9863...be434f )
by
unknown
40:07 queued 25:06
created

AbstractGridObject::getContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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 TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace TYPO3\CMS\Backend\View\BackendLayout\Grid;
19
20
use TYPO3\CMS\Backend\View\PageLayoutContext;
21
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
22
use TYPO3\CMS\Core\Imaging\IconFactory;
23
use TYPO3\CMS\Core\Localization\LanguageService;
24
use TYPO3\CMS\Core\Utility\GeneralUtility;
25
use TYPO3\CMS\Core\Utility\StringUtility;
26
27
/**
28
 * Base class for objects which constitute a page layout grid.
29
 *
30
 * Contains shared properties and functions available to all such objects.
31
 *
32
 * @see Grid
33
 * @see GridRow
34
 * @see GridColumn
35
 * @see GridColumnItem
36
 * @see LanguageColumn
37
 */
38
abstract class AbstractGridObject
39
{
40
    /**
41
     * @var PageLayoutContext
42
     */
43
    protected $context;
44
45
    /**
46
     * @var IconFactory
47
     */
48
    protected $iconFactory;
49
50
    /**
51
     * @var string|null
52
     */
53
    protected $uniqueId;
54
55
    public function __construct(PageLayoutContext $context)
56
    {
57
        $this->context = $context;
58
        $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
59
    }
60
61
    public function getUniqueId(): string
62
    {
63
        return $this->uniqueId ?? $this->uniqueId = StringUtility::getUniqueId();
64
    }
65
66
    public function getContext(): PageLayoutContext
67
    {
68
        return $this->context;
69
    }
70
71
    protected function getLanguageService(): LanguageService
72
    {
73
        return $GLOBALS['LANG'];
74
    }
75
76
    protected function getBackendUser(): BackendUserAuthentication
77
    {
78
        return $GLOBALS['BE_USER'];
79
    }
80
}
81