Completed
Push — master ( ee9fc9...5a65c0 )
by Fabien
09:19
created
Configuration/TCA/Overrides/fe_groups.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -2,58 +2,58 @@
 block discarded – undo
2 2
 if (!defined('TYPO3_MODE')) die ('Access denied.');
3 3
 
4 4
 $tca = [
5
-    'vidi' => [
6
-        // Special case when the field name does not follow the conventions.
7
-        // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName.
8
-        'mappings' => [
9
-            'lockToDomain' => 'lockToDomain',
10
-            'TSconfig' => 'tsConfig',
11
-            'felogin_redirectPid' => 'feLoginRedirectPid',
12
-        ],
13
-    ],
14
-    'grid' => [
15
-        'facets' => [
16
-            'uid',
17
-            'title',
18
-            'description',
19
-            new \Fab\Vidi\Facet\PageFacet(
20
-                'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid'
21
-            ),
22
-        ],
23
-        'columns' => [
24
-            '__checkbox' => [
25
-                'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class,
26
-            ],
27
-            'uid' => [
28
-                'visible' => false,
29
-                'label' => 'Id',
30
-                'width' => '5px',
31
-            ],
32
-            'title' => [
33
-                'visible' => true,
34
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title',
35
-                'editable' => true,
36
-            ],
37
-            'tstamp' => [
38
-                'visible' => false,
39
-                'format' => 'Fab\Vidi\Formatter\Date',
40
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp',
41
-            ],
42
-            'crdate' => [
43
-                'visible' => false,
44
-                'format' => 'Fab\Vidi\Formatter\Date',
45
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate',
46
-            ],
47
-            'hidden' => [
48
-                'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer',
49
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation',
50
-                'width' => '3%',
51
-            ],
52
-            '__buttons' => [
53
-                'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class,
54
-            ],
55
-        ]
56
-    ]
5
+	'vidi' => [
6
+		// Special case when the field name does not follow the conventions.
7
+		// Vidi needs a bit of help to find the equivalence fieldName <-> propertyName.
8
+		'mappings' => [
9
+			'lockToDomain' => 'lockToDomain',
10
+			'TSconfig' => 'tsConfig',
11
+			'felogin_redirectPid' => 'feLoginRedirectPid',
12
+		],
13
+	],
14
+	'grid' => [
15
+		'facets' => [
16
+			'uid',
17
+			'title',
18
+			'description',
19
+			new \Fab\Vidi\Facet\PageFacet(
20
+				'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid'
21
+			),
22
+		],
23
+		'columns' => [
24
+			'__checkbox' => [
25
+				'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class,
26
+			],
27
+			'uid' => [
28
+				'visible' => false,
29
+				'label' => 'Id',
30
+				'width' => '5px',
31
+			],
32
+			'title' => [
33
+				'visible' => true,
34
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title',
35
+				'editable' => true,
36
+			],
37
+			'tstamp' => [
38
+				'visible' => false,
39
+				'format' => 'Fab\Vidi\Formatter\Date',
40
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp',
41
+			],
42
+			'crdate' => [
43
+				'visible' => false,
44
+				'format' => 'Fab\Vidi\Formatter\Date',
45
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate',
46
+			],
47
+			'hidden' => [
48
+				'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer',
49
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation',
50
+				'width' => '3%',
51
+			],
52
+			'__buttons' => [
53
+				'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class,
54
+			],
55
+		]
56
+	]
57 57
 ];
58 58
 
59 59
 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_groups'], $tca);
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Configuration/TCA/Overrides/fe_users.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -2,110 +2,110 @@
 block discarded – undo
2 2
 if (!defined('TYPO3_MODE')) die ('Access denied.');
3 3
 
4 4
 $tca = [
5
-    'ctrl' => [
6
-        // By default "searchFields" has many fields which has a performance cost when dealing with large data-set.
7
-        // Override search field for performance reason.
8
-        // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup',
9
-        'searchFields' => 'username, first_name, last_name, usergroup',
10
-    ],
11
-    'vidi' => [
12
-        // Special case when the field name does not follow the conventions.
13
-        // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName.
14
-        'mappings' => [
15
-            'lockToDomain' => 'lockToDomain',
16
-            'TSconfig' => 'tsConfig',
17
-            'felogin_redirectPid' => 'feLoginRedirectPid',
18
-            'felogin_forgotHash' => 'feLoginForgotHash',
19
-        ],
20
-    ],
21
-    'grid' => [
22
-        'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token',
23
-        'export' => [
24
-            'include_files' => false,
25
-        ],
26
-        'facets' => [
27
-            'uid',
28
-            'username',
29
-            'name',
30
-            'first_name',
31
-            'last_name',
32
-            'middle_name',
33
-            'address',
34
-            'telephone',
35
-            'fax',
36
-            'email',
37
-            'title',
38
-            'zip',
39
-            'city',
40
-            'country',
41
-            'company',
42
-            'usergroup',
43
-            new \Fab\Vidi\Facet\StandardFacet(
44
-                'disable',
45
-                'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active',
46
-                [
47
-                    '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0',
48
-                    '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1'
49
-                ]
50
-            ),
51
-            new \Fab\Vidi\Facet\PageFacet(
52
-                'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid'
53
-            ),
54
-        ],
55
-        'columns' => [
56
-            '__checkbox' => [
57
-                'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class,
58
-            ],
59
-            'uid' => [
60
-                'visible' => false,
61
-                'label' => 'Id',
62
-                'width' => '5px',
63
-            ],
64
-            'username' => [
65
-                'visible' => true,
66
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username',
67
-                'editable' => true,
68
-            ],
69
-            'name' => [
70
-                'visible' => true,
71
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name',
72
-                'editable' => true,
73
-            ],
74
-            'email' => [
75
-                'visible' => true,
76
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email',
77
-                'editable' => true,
78
-            ],
79
-            'usergroup' => [
80
-                'visible' => true,
81
-                'renderers' => [
82
-                    'Fab\Vidi\Grid\RelationEditRenderer',
83
-                    'Fab\Vidi\Grid\RelationRenderer',
84
-                ],
85
-                'editable' => true,
86
-                'sortable' => false,
87
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup',
88
-            ],
89
-            'tstamp' => [
90
-                'visible' => false,
91
-                'format' => 'Fab\Vidi\Formatter\Date',
92
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp',
93
-            ],
94
-            'crdate' => [
95
-                'visible' => false,
96
-                'format' => 'Fab\Vidi\Formatter\Date',
97
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate',
98
-            ],
99
-            'disable' => [
100
-                'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer',
101
-                'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active',
102
-                'width' => '3%',
103
-            ],
104
-            '__buttons' => [
105
-                'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class,
106
-            ],
107
-        ],
108
-    ],
5
+	'ctrl' => [
6
+		// By default "searchFields" has many fields which has a performance cost when dealing with large data-set.
7
+		// Override search field for performance reason.
8
+		// To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup',
9
+		'searchFields' => 'username, first_name, last_name, usergroup',
10
+	],
11
+	'vidi' => [
12
+		// Special case when the field name does not follow the conventions.
13
+		// Vidi needs a bit of help to find the equivalence fieldName <-> propertyName.
14
+		'mappings' => [
15
+			'lockToDomain' => 'lockToDomain',
16
+			'TSconfig' => 'tsConfig',
17
+			'felogin_redirectPid' => 'feLoginRedirectPid',
18
+			'felogin_forgotHash' => 'feLoginForgotHash',
19
+		],
20
+	],
21
+	'grid' => [
22
+		'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token',
23
+		'export' => [
24
+			'include_files' => false,
25
+		],
26
+		'facets' => [
27
+			'uid',
28
+			'username',
29
+			'name',
30
+			'first_name',
31
+			'last_name',
32
+			'middle_name',
33
+			'address',
34
+			'telephone',
35
+			'fax',
36
+			'email',
37
+			'title',
38
+			'zip',
39
+			'city',
40
+			'country',
41
+			'company',
42
+			'usergroup',
43
+			new \Fab\Vidi\Facet\StandardFacet(
44
+				'disable',
45
+				'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active',
46
+				[
47
+					'0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0',
48
+					'1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1'
49
+				]
50
+			),
51
+			new \Fab\Vidi\Facet\PageFacet(
52
+				'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid'
53
+			),
54
+		],
55
+		'columns' => [
56
+			'__checkbox' => [
57
+				'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class,
58
+			],
59
+			'uid' => [
60
+				'visible' => false,
61
+				'label' => 'Id',
62
+				'width' => '5px',
63
+			],
64
+			'username' => [
65
+				'visible' => true,
66
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username',
67
+				'editable' => true,
68
+			],
69
+			'name' => [
70
+				'visible' => true,
71
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name',
72
+				'editable' => true,
73
+			],
74
+			'email' => [
75
+				'visible' => true,
76
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email',
77
+				'editable' => true,
78
+			],
79
+			'usergroup' => [
80
+				'visible' => true,
81
+				'renderers' => [
82
+					'Fab\Vidi\Grid\RelationEditRenderer',
83
+					'Fab\Vidi\Grid\RelationRenderer',
84
+				],
85
+				'editable' => true,
86
+				'sortable' => false,
87
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup',
88
+			],
89
+			'tstamp' => [
90
+				'visible' => false,
91
+				'format' => 'Fab\Vidi\Formatter\Date',
92
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp',
93
+			],
94
+			'crdate' => [
95
+				'visible' => false,
96
+				'format' => 'Fab\Vidi\Formatter\Date',
97
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate',
98
+			],
99
+			'disable' => [
100
+				'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer',
101
+				'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active',
102
+				'width' => '3%',
103
+			],
104
+			'__buttons' => [
105
+				'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class,
106
+			],
107
+		],
108
+	],
109 109
 ];
110 110
 
111 111
 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_users'], $tca);
Please login to merge, or discard this patch.
Classes/Controller/FacetController.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -20,55 +20,55 @@
 block discarded – undo
20 20
 class FacetController extends ActionController
21 21
 {
22 22
 
23
-    /**
24
-     * Suggest values according to a facet.
25
-     * Output a json list of key / values.
26
-     *
27
-     * @param string $facet
28
-     * @param string $searchTerm
29
-     * @validate $facet Fab\Vidi\Domain\Validator\FacetValidator
30
-     * @return string
31
-     */
32
-    public function autoSuggestAction($facet, $searchTerm)
33
-    {
23
+	/**
24
+	 * Suggest values according to a facet.
25
+	 * Output a json list of key / values.
26
+	 *
27
+	 * @param string $facet
28
+	 * @param string $searchTerm
29
+	 * @validate $facet Fab\Vidi\Domain\Validator\FacetValidator
30
+	 * @return string
31
+	 */
32
+	public function autoSuggestAction($facet, $searchTerm)
33
+	{
34 34
 
35
-        $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet);
35
+		$suggestions = $this->getFacetSuggestionService()->getSuggestions($facet);
36 36
 
37
-        # Json header is not automatically sent in the BE...
38
-        $this->response->setHeader('Content-Type', 'application/json');
39
-        $this->response->sendHeaders();
40
-        return json_encode($suggestions);
41
-    }
37
+		# Json header is not automatically sent in the BE...
38
+		$this->response->setHeader('Content-Type', 'application/json');
39
+		$this->response->sendHeaders();
40
+		return json_encode($suggestions);
41
+	}
42 42
 
43
-    /**
44
-     * Suggest values for all configured facets in the Grid.
45
-     * Output a json list of key / values.
46
-     *
47
-     * @return string
48
-     * @throws \Exception
49
-     */
50
-    public function autoSuggestsAction()
51
-    {
43
+	/**
44
+	 * Suggest values for all configured facets in the Grid.
45
+	 * Output a json list of key / values.
46
+	 *
47
+	 * @return string
48
+	 * @throws \Exception
49
+	 */
50
+	public function autoSuggestsAction()
51
+	{
52 52
 
53
-        $suggestions = [];
54
-        foreach (Tca::grid()->getFacets() as $facet) {
55
-            /** @var FacetInterface $facet */
56
-            $name = $facet->getName();
57
-            $suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name);
58
-        }
53
+		$suggestions = [];
54
+		foreach (Tca::grid()->getFacets() as $facet) {
55
+			/** @var FacetInterface $facet */
56
+			$name = $facet->getName();
57
+			$suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name);
58
+		}
59 59
 
60
-        # Json header is not automatically sent in the BE...
61
-        $this->response->setHeader('Content-Type', 'application/json');
62
-        $this->response->sendHeaders();
63
-        return json_encode($suggestions);
64
-    }
60
+		# Json header is not automatically sent in the BE...
61
+		$this->response->setHeader('Content-Type', 'application/json');
62
+		$this->response->sendHeaders();
63
+		return json_encode($suggestions);
64
+	}
65 65
 
66
-    /**
67
-     * @return FacetSuggestionService|object
68
-     */
69
-    protected function getFacetSuggestionService()
70
-    {
71
-        return GeneralUtility::makeInstance(FacetSuggestionService::class);
72
-    }
66
+	/**
67
+	 * @return FacetSuggestionService|object
68
+	 */
69
+	protected function getFacetSuggestionService()
70
+	{
71
+		return GeneralUtility::makeInstance(FacetSuggestionService::class);
72
+	}
73 73
 
74 74
 }
Please login to merge, or discard this patch.
Classes/Facet/PageFacet.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -22,170 +22,170 @@
 block discarded – undo
22 22
 class PageFacet implements FacetInterface
23 23
 {
24 24
 
25
-    /**
26
-     * @var string
27
-     */
28
-    protected $name;
29
-
30
-    /**
31
-     * @var string
32
-     */
33
-    protected $label;
34
-
35
-    /**
36
-     * @var bool
37
-     */
38
-    protected $canModifyMatcher = false;
39
-
40
-    /**
41
-     * Constructor of a Generic Facet in Vidi.
42
-     *
43
-     * @param string $label
44
-     */
45
-    public function __construct($label = '')
46
-    {
47
-        $this->name = 'pid';
48
-        $this->label = $label;
49
-    }
50
-
51
-    /**
52
-     * @return string
53
-     */
54
-    public function getName()
55
-    {
56
-        return $this->name;
57
-    }
58
-
59
-    /**
60
-     * @return string
61
-     */
62
-    public function getLabel()
63
-    {
64
-        $label = '';
65
-        try {
66
-            $label = LocalizationUtility::translate($this->label, '');
67
-        } catch (\InvalidArgumentException $e) {
68
-        }
69
-
70
-        return $label;
71
-    }
72
-
73
-    /**
74
-     * @return array
75
-     */
76
-    public function getSuggestions()
77
-    {
78
-        $values = [];
79
-        foreach ($this->getStoragePages() as $page) {
80
-            $values[] = [
81
-                $page['uid'] => sprintf('%s (%s)', $page['title'], $page['uid'])
82
-            ];
83
-        }
84
-        return $values;
85
-    }
86
-
87
-    /**
88
-     * @return array
89
-     */
90
-    protected function getStoragePages()
91
-    {
92
-        $tableName = 'pages';
93
-        $clause = sprintf(
94
-            'uid IN (SELECT DISTINCT(pid) FROM %s WHERE 1=1 %s)',
95
-            $this->getModuleLoader()->getDataType(),
96
-            BackendUtility::deleteClause($this->getModuleLoader()->getDataType())
97
-        );
98
-        $clause .= BackendUtility::deleteClause('pages');
99
-
100
-        $pages = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $tableName, $clause);
101
-
102
-        return is_array($pages)
103
-            ? $pages
104
-            : [];
105
-    }
106
-
107
-    /**
108
-     * Returns a pointer to the database.
109
-     *
110
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
111
-     */
112
-    protected function getDatabaseConnection()
113
-    {
114
-        return $GLOBALS['TYPO3_DB'];
115
-    }
116
-
117
-    /**
118
-     * @return LanguageService
119
-     */
120
-    protected function getLanguageService()
121
-    {
122
-
123
-        /** @var LanguageService $langService */
124
-        $langService = $GLOBALS['LANG'];
125
-        if (!$langService) {
126
-            $langService = GeneralUtility::makeInstance(LanguageService::class);
127
-            $langService->init('en');
128
-        }
129
-
130
-        return $langService;
131
-    }
132
-
133
-    /**
134
-     * @return bool
135
-     */
136
-    public function hasSuggestions()
137
-    {
138
-        return true;
139
-    }
140
-
141
-    /**
142
-     * @param string $dataType
143
-     * @return $this
144
-     */
145
-    public function setDataType($dataType)
146
-    {
147
-        $this->dataType = $dataType;
148
-        return $this;
149
-    }
150
-
151
-    /**
152
-     * @return bool
153
-     */
154
-    public function canModifyMatcher()
155
-    {
156
-        return $this->canModifyMatcher;
157
-    }
158
-
159
-    /**
160
-     * @param Matcher $matcher
161
-     * @param $value
162
-     * @return Matcher
163
-     */
164
-    public function modifyMatcher(Matcher $matcher, $value)
165
-    {
166
-        return $matcher;
167
-    }
168
-
169
-    /**
170
-     * Get the Vidi Module Loader.
171
-     *
172
-     * @return ModuleLoader|object
173
-     * @throws \InvalidArgumentException
174
-     */
175
-    protected function getModuleLoader()
176
-    {
177
-        return GeneralUtility::makeInstance(ModuleLoader::class);
178
-    }
179
-
180
-    /**
181
-     * Magic method implementation for retrieving state.
182
-     *
183
-     * @param array $states
184
-     * @return PageFacet
185
-     */
186
-    static public function __set_state($states)
187
-    {
188
-        return new self($states['name']);
189
-    }
25
+	/**
26
+	 * @var string
27
+	 */
28
+	protected $name;
29
+
30
+	/**
31
+	 * @var string
32
+	 */
33
+	protected $label;
34
+
35
+	/**
36
+	 * @var bool
37
+	 */
38
+	protected $canModifyMatcher = false;
39
+
40
+	/**
41
+	 * Constructor of a Generic Facet in Vidi.
42
+	 *
43
+	 * @param string $label
44
+	 */
45
+	public function __construct($label = '')
46
+	{
47
+		$this->name = 'pid';
48
+		$this->label = $label;
49
+	}
50
+
51
+	/**
52
+	 * @return string
53
+	 */
54
+	public function getName()
55
+	{
56
+		return $this->name;
57
+	}
58
+
59
+	/**
60
+	 * @return string
61
+	 */
62
+	public function getLabel()
63
+	{
64
+		$label = '';
65
+		try {
66
+			$label = LocalizationUtility::translate($this->label, '');
67
+		} catch (\InvalidArgumentException $e) {
68
+		}
69
+
70
+		return $label;
71
+	}
72
+
73
+	/**
74
+	 * @return array
75
+	 */
76
+	public function getSuggestions()
77
+	{
78
+		$values = [];
79
+		foreach ($this->getStoragePages() as $page) {
80
+			$values[] = [
81
+				$page['uid'] => sprintf('%s (%s)', $page['title'], $page['uid'])
82
+			];
83
+		}
84
+		return $values;
85
+	}
86
+
87
+	/**
88
+	 * @return array
89
+	 */
90
+	protected function getStoragePages()
91
+	{
92
+		$tableName = 'pages';
93
+		$clause = sprintf(
94
+			'uid IN (SELECT DISTINCT(pid) FROM %s WHERE 1=1 %s)',
95
+			$this->getModuleLoader()->getDataType(),
96
+			BackendUtility::deleteClause($this->getModuleLoader()->getDataType())
97
+		);
98
+		$clause .= BackendUtility::deleteClause('pages');
99
+
100
+		$pages = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $tableName, $clause);
101
+
102
+		return is_array($pages)
103
+			? $pages
104
+			: [];
105
+	}
106
+
107
+	/**
108
+	 * Returns a pointer to the database.
109
+	 *
110
+	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
111
+	 */
112
+	protected function getDatabaseConnection()
113
+	{
114
+		return $GLOBALS['TYPO3_DB'];
115
+	}
116
+
117
+	/**
118
+	 * @return LanguageService
119
+	 */
120
+	protected function getLanguageService()
121
+	{
122
+
123
+		/** @var LanguageService $langService */
124
+		$langService = $GLOBALS['LANG'];
125
+		if (!$langService) {
126
+			$langService = GeneralUtility::makeInstance(LanguageService::class);
127
+			$langService->init('en');
128
+		}
129
+
130
+		return $langService;
131
+	}
132
+
133
+	/**
134
+	 * @return bool
135
+	 */
136
+	public function hasSuggestions()
137
+	{
138
+		return true;
139
+	}
140
+
141
+	/**
142
+	 * @param string $dataType
143
+	 * @return $this
144
+	 */
145
+	public function setDataType($dataType)
146
+	{
147
+		$this->dataType = $dataType;
148
+		return $this;
149
+	}
150
+
151
+	/**
152
+	 * @return bool
153
+	 */
154
+	public function canModifyMatcher()
155
+	{
156
+		return $this->canModifyMatcher;
157
+	}
158
+
159
+	/**
160
+	 * @param Matcher $matcher
161
+	 * @param $value
162
+	 * @return Matcher
163
+	 */
164
+	public function modifyMatcher(Matcher $matcher, $value)
165
+	{
166
+		return $matcher;
167
+	}
168
+
169
+	/**
170
+	 * Get the Vidi Module Loader.
171
+	 *
172
+	 * @return ModuleLoader|object
173
+	 * @throws \InvalidArgumentException
174
+	 */
175
+	protected function getModuleLoader()
176
+	{
177
+		return GeneralUtility::makeInstance(ModuleLoader::class);
178
+	}
179
+
180
+	/**
181
+	 * Magic method implementation for retrieving state.
182
+	 *
183
+	 * @param array $states
184
+	 * @return PageFacet
185
+	 */
186
+	static public function __set_state($states)
187
+	{
188
+		return new self($states['name']);
189
+	}
190 190
 
191 191
 }
Please login to merge, or discard this patch.
Classes/Facet/StandardFacet.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -20,156 +20,156 @@
 block discarded – undo
20 20
 class StandardFacet implements FacetInterface
21 21
 {
22 22
 
23
-    /**
24
-     * @var string
25
-     */
26
-    protected $name;
27
-
28
-    /**
29
-     * @var string
30
-     */
31
-    protected $label;
32
-
33
-    /**
34
-     * @var array
35
-     */
36
-    protected $suggestions = [];
37
-
38
-    /**
39
-     * @var string
40
-     */
41
-    protected $dataType;
42
-
43
-    /**
44
-     * @var bool
45
-     */
46
-    protected $canModifyMatcher = false;
47
-
48
-    /**
49
-     * Constructor of a Generic Facet in Vidi.
50
-     *
51
-     * @param string $name
52
-     * @param string $label
53
-     * @param array $suggestions
54
-     */
55
-    public function __construct($name, $label = '', array $suggestions = array())
56
-    {
57
-        $this->name = $name;
58
-        if (empty($label)) {
59
-            $label = $this->name;
60
-        }
61
-        $this->label = $label;
62
-        $this->suggestions = $suggestions;
63
-    }
64
-
65
-    /**
66
-     * @return string
67
-     */
68
-    public function getName()
69
-    {
70
-        return $this->name;
71
-    }
72
-
73
-    /**
74
-     * @return string
75
-     */
76
-    public function getLabel()
77
-    {
78
-        if ($this->label === $this->name) {
79
-            $label = Tca::table($this->dataType)->field($this->getName())->getLabel();
80
-        } else {
81
-            try {
82
-                $label = LocalizationUtility::translate($this->label, '');
83
-            } catch (\InvalidArgumentException $e) {
84
-            }
85
-            if (empty($label)) {
86
-                $label = $this->label;
87
-            }
88
-        }
89
-
90
-        return $label;
91
-    }
92
-
93
-    /**
94
-     * @return array
95
-     */
96
-    public function getSuggestions()
97
-    {
98
-
99
-        $values = [];
100
-        foreach ($this->suggestions as $key => $label) {
101
-            $localizedLabel = $this->getLanguageService()->sL($label);
102
-            if (!empty($localizedLabel)) {
103
-                $label = $localizedLabel;
104
-            }
105
-
106
-            $values[] = [$key => $label];
107
-        }
108
-
109
-        return $values;
110
-    }
111
-
112
-    /**
113
-     * @return LanguageService
114
-     */
115
-    protected function getLanguageService()
116
-    {
117
-
118
-        /** @var LanguageService $langService */
119
-        $langService = $GLOBALS['LANG'];
120
-        if (!$langService) {
121
-            $langService = GeneralUtility::makeInstance(LanguageService::class);
122
-            $langService->init('en');
123
-        }
124
-
125
-        return $langService;
126
-    }
127
-
128
-    /**
129
-     * @return bool
130
-     */
131
-    public function hasSuggestions()
132
-    {
133
-        return !empty($this->suggestions);
134
-    }
135
-
136
-    /**
137
-     * @param string $dataType
138
-     * @return $this
139
-     */
140
-    public function setDataType($dataType)
141
-    {
142
-        $this->dataType = $dataType;
143
-        return $this;
144
-    }
145
-
146
-    /**
147
-     * @return bool
148
-     */
149
-    public function canModifyMatcher()
150
-    {
151
-        return $this->canModifyMatcher;
152
-    }
153
-
154
-    /**
155
-     * @param Matcher $matcher
156
-     * @param $value
157
-     * @return Matcher
158
-     */
159
-    public function modifyMatcher(Matcher $matcher, $value)
160
-    {
161
-        return $matcher;
162
-    }
163
-
164
-    /**
165
-     * Magic method implementation for retrieving state.
166
-     *
167
-     * @param array $states
168
-     * @return StandardFacet
169
-     */
170
-    static public function __set_state($states)
171
-    {
172
-        return new StandardFacet($states['name'], $states['label'], $states['suggestions']);
173
-    }
23
+	/**
24
+	 * @var string
25
+	 */
26
+	protected $name;
27
+
28
+	/**
29
+	 * @var string
30
+	 */
31
+	protected $label;
32
+
33
+	/**
34
+	 * @var array
35
+	 */
36
+	protected $suggestions = [];
37
+
38
+	/**
39
+	 * @var string
40
+	 */
41
+	protected $dataType;
42
+
43
+	/**
44
+	 * @var bool
45
+	 */
46
+	protected $canModifyMatcher = false;
47
+
48
+	/**
49
+	 * Constructor of a Generic Facet in Vidi.
50
+	 *
51
+	 * @param string $name
52
+	 * @param string $label
53
+	 * @param array $suggestions
54
+	 */
55
+	public function __construct($name, $label = '', array $suggestions = array())
56
+	{
57
+		$this->name = $name;
58
+		if (empty($label)) {
59
+			$label = $this->name;
60
+		}
61
+		$this->label = $label;
62
+		$this->suggestions = $suggestions;
63
+	}
64
+
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function getName()
69
+	{
70
+		return $this->name;
71
+	}
72
+
73
+	/**
74
+	 * @return string
75
+	 */
76
+	public function getLabel()
77
+	{
78
+		if ($this->label === $this->name) {
79
+			$label = Tca::table($this->dataType)->field($this->getName())->getLabel();
80
+		} else {
81
+			try {
82
+				$label = LocalizationUtility::translate($this->label, '');
83
+			} catch (\InvalidArgumentException $e) {
84
+			}
85
+			if (empty($label)) {
86
+				$label = $this->label;
87
+			}
88
+		}
89
+
90
+		return $label;
91
+	}
92
+
93
+	/**
94
+	 * @return array
95
+	 */
96
+	public function getSuggestions()
97
+	{
98
+
99
+		$values = [];
100
+		foreach ($this->suggestions as $key => $label) {
101
+			$localizedLabel = $this->getLanguageService()->sL($label);
102
+			if (!empty($localizedLabel)) {
103
+				$label = $localizedLabel;
104
+			}
105
+
106
+			$values[] = [$key => $label];
107
+		}
108
+
109
+		return $values;
110
+	}
111
+
112
+	/**
113
+	 * @return LanguageService
114
+	 */
115
+	protected function getLanguageService()
116
+	{
117
+
118
+		/** @var LanguageService $langService */
119
+		$langService = $GLOBALS['LANG'];
120
+		if (!$langService) {
121
+			$langService = GeneralUtility::makeInstance(LanguageService::class);
122
+			$langService->init('en');
123
+		}
124
+
125
+		return $langService;
126
+	}
127
+
128
+	/**
129
+	 * @return bool
130
+	 */
131
+	public function hasSuggestions()
132
+	{
133
+		return !empty($this->suggestions);
134
+	}
135
+
136
+	/**
137
+	 * @param string $dataType
138
+	 * @return $this
139
+	 */
140
+	public function setDataType($dataType)
141
+	{
142
+		$this->dataType = $dataType;
143
+		return $this;
144
+	}
145
+
146
+	/**
147
+	 * @return bool
148
+	 */
149
+	public function canModifyMatcher()
150
+	{
151
+		return $this->canModifyMatcher;
152
+	}
153
+
154
+	/**
155
+	 * @param Matcher $matcher
156
+	 * @param $value
157
+	 * @return Matcher
158
+	 */
159
+	public function modifyMatcher(Matcher $matcher, $value)
160
+	{
161
+		return $matcher;
162
+	}
163
+
164
+	/**
165
+	 * Magic method implementation for retrieving state.
166
+	 *
167
+	 * @param array $states
168
+	 * @return StandardFacet
169
+	 */
170
+	static public function __set_state($states)
171
+	{
172
+		return new StandardFacet($states['name'], $states['label'], $states['suggestions']);
173
+	}
174 174
 
175 175
 }
Please login to merge, or discard this patch.