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

DrawingConfiguration::getLocalizedPageTitle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 29
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 23
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 29
rs 9.552
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\Drawing;
19
20
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
21
use TYPO3\CMS\Core\Localization\LanguageService;
22
23
/**
24
 * Drawing Configuration
25
 *
26
 * Attached to BackendLayout as storage for configuration options which
27
 * determine how a page layout is rendered. Contains settings for active
28
 * language, show-hidden, site languages etc. and returns TCA labels for
29
 * tt_content fields and CTypes.
30
 *
31
 * Corresponds to legacy public properties from PageLayoutView.
32
 */
33
class DrawingConfiguration
34
{
35
    /**
36
     * @var int
37
     */
38
    protected $selectedLanguageId = 0;
39
40
    /**
41
     * Determines whether rendering should happen with a visually aligned
42
     * connection between default language and translation. When rendered
43
     * with this flag enabled, any translated versions are vertically
44
     * aligned so they are rendered in the same visual row as the original.
45
     *
46
     * @var bool
47
     */
48
    protected $defaultLanguageBinding = true;
49
50
    /**
51
     * If TRUE, indicates that the current rendering method shows multiple
52
     * languages (e.g. the "page" module is set in "Languages" mode.
53
     *
54
     * @var bool
55
     */
56
    protected $languageMode = false;
57
58
    /**
59
     * Key => "Language ID", Value "Label of language"
60
     *
61
     * @var array
62
     */
63
    protected $languageColumns = [];
64
65
    /**
66
     * Whether or not to show hidden records when rendering column contents.
67
     *
68
     * @var bool
69
     */
70
    protected $showHidden = true;
71
72
    /**
73
     * An array list of currently active columns. Only column identifiers
74
     * (colPos value) which are contained in this array will be rendered in
75
     * the page module.
76
     *
77
     * @var array
78
     */
79
    protected $activeColumns = [1, 0, 2, 3];
80
81
    /**
82
     * Whether or not to show the "new content" buttons that open the new content
83
     * wizard, when rendering columns. Disabling this will disable the rendering
84
     * of new content buttons both in column top and after each content element.
85
     *
86
     * @var bool
87
     */
88
    protected $showNewContentWizard = true;
89
90
    public function getSelectedLanguageId(): int
91
    {
92
        return $this->selectedLanguageId;
93
    }
94
95
    public function setSelectedLanguageId(int $selectedLanguageId): void
96
    {
97
        $this->selectedLanguageId = $selectedLanguageId;
98
    }
99
100
    public function getDefaultLanguageBinding(): bool
101
    {
102
        return $this->defaultLanguageBinding;
103
    }
104
105
    public function setDefaultLanguageBinding(bool $defaultLanguageBinding): void
106
    {
107
        $this->defaultLanguageBinding = $defaultLanguageBinding;
108
    }
109
110
    public function getLanguageMode(): bool
111
    {
112
        return $this->languageMode;
113
    }
114
115
    public function setLanguageMode(bool $languageMode): void
116
    {
117
        $this->languageMode = $languageMode;
118
    }
119
120
    public function getLanguageColumns(): array
121
    {
122
        if (empty($this->languageColumns)) {
123
            return [0 => 'Default'];
124
        }
125
        return $this->languageColumns;
126
    }
127
128
    public function setLanguageColumns(array $languageColumns): void
129
    {
130
        $this->languageColumns = $languageColumns;
131
    }
132
133
    public function getShowHidden(): bool
134
    {
135
        return $this->showHidden;
136
    }
137
138
    public function setShowHidden(bool $showHidden): void
139
    {
140
        $this->showHidden = $showHidden;
141
    }
142
143
    public function getActiveColumns(): array
144
    {
145
        return $this->activeColumns;
146
    }
147
148
    public function setActiveColumns(array $activeColumns): void
149
    {
150
        $this->activeColumns = $activeColumns;
151
    }
152
153
    public function getShowNewContentWizard(): bool
154
    {
155
        return $this->showNewContentWizard;
156
    }
157
158
    public function setShowNewContentWizard(bool $showNewContentWizard): void
159
    {
160
        $this->showNewContentWizard = $showNewContentWizard;
161
    }
162
163
    protected function getBackendUser(): BackendUserAuthentication
164
    {
165
        return $GLOBALS['BE_USER'];
166
    }
167
168
    protected function getLanguageService(): LanguageService
169
    {
170
        return $GLOBALS['LANG'];
171
    }
172
}
173