11<?php
22
33/**
4- * The MetaModels extension allows the creation of multiple collections of custom items,
5- * each with its own unique set of selectable attributes, with attribute extendability.
6- * The Front-End modules allow you to build powerful listing and filtering of the
7- * data in each collection.
4+ * This file is part of MetaModels/filter_range.
85 *
9- * @package MetaModels
10- * @subpackage FilterRange
6+ * (c) 2012-2019 The MetaModels team.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ *
11+ * This project is provided in good faith and hope to be usable by anyone.
12+ *
13+ * @package MetaModels/filter_range
1114 * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1215 * @author Stefan Heimes <stefan_heimes@hotmail.com>
13- * @copyright 2015 The MetaModels team.
14- * @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0
16+ * @copyright 2012-2019 The MetaModels team.
17+ * @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later
1518 * @filesource
1619 */
1720
@@ -160,14 +163,19 @@ protected function prepareWidgetLabel($objAttribute)
160163 'GET: ' . $ this ->getParamName ()
161164 );
162165
163- if ($ this ->get ('fromfield ' ) && $ this ->get ('tofield ' )) {
166+ $ fromField = $ this ->get ('fromfield ' );
167+ $ toField = $ this ->get ('tofield ' );
168+ if ($ fromField && $ toField ) {
164169 $ arrLabel [0 ] .= ' ' . $ GLOBALS ['TL_LANG ' ]['metamodels_frontendfilter ' ]['fromto ' ];
165- } elseif ($ this ->get ('fromfield ' ) && !$ this ->get ('tofield ' )) {
170+ return $ arrLabel ;
171+ }
172+ if ($ fromField && !$ toField ) {
166173 $ arrLabel [0 ] .= ' ' . $ GLOBALS ['TL_LANG ' ]['metamodels_frontendfilter ' ]['from ' ];
167- } else {
168- $ arrLabel [0 ] .= ' ' . $ GLOBALS ['TL_LANG ' ]['metamodels_frontendfilter ' ]['to ' ];
174+ return $ arrLabel ;
169175 }
170176
177+ $ arrLabel [0 ] .= ' ' . $ GLOBALS ['TL_LANG ' ]['metamodels_frontendfilter ' ]['to ' ];
178+
171179 return $ arrLabel ;
172180 }
173181
@@ -192,7 +200,7 @@ protected function prepareWidgetOptions($arrIds, $objAttribute)
192200 $ mixOption = strip_tags ($ mixOption );
193201 $ mixOption = trim ($ mixOption );
194202
195- if ($ mixOption === '' || $ mixOption === null ) {
203+ if ('' === $ mixOption || null === $ mixOption ) {
196204 unset($ arrOptions [$ mixKeyOption ]);
197205 }
198206 }
@@ -226,13 +234,13 @@ protected function prepareWidgetParamAndFilterUrl($arrFilterUrl)
226234 if ($ parameterValue && ($ parameterValue [0 ] || $ parameterValue [1 ])) {
227235 $ privateFilterUrl [$ parameterName ] = $ parameterValue ;
228236
229- return array ($ privateFilterUrl , $ parameterValue );
230- } else {
231- // No values given, clear the array.
232- $ parameterValue = null ;
233-
234237 return array ($ privateFilterUrl , $ parameterValue );
235238 }
239+
240+ // No values given, clear the array.
241+ $ parameterValue = null ;
242+
243+ return array ($ privateFilterUrl , $ parameterValue );
236244 }
237245
238246 return array ($ privateFilterUrl , $ parameterValue );
@@ -262,7 +270,7 @@ protected function getFilterWidgetParameters(IAttribute $attribute, $currentValu
262270 'size ' => ($ this ->get ('fromfield ' ) && $ this ->get ('tofield ' ) ? 2 : 1 ),
263271 'urlparam ' => $ this ->getParamName (),
264272 'template ' => $ this ->get ('template ' ),
265- 'colname ' => $ attribute ->getColname (),
273+ 'colname ' => $ attribute ->getColName (),
266274 ),
267275 // We need to implode to have it transported correctly in the frontend filter.
268276 'urlvalue ' => !empty ($ currentValue ) ? implode ('__ ' , $ currentValue ) : ''
@@ -271,9 +279,6 @@ protected function getFilterWidgetParameters(IAttribute $attribute, $currentValu
271279
272280 /**
273281 * {@inheritdoc}
274- *
275- * @SuppressWarnings(PHPMD.Superglobals)
276- * @SuppressWarnings(PHPMD.CamelCaseVariableName)
277282 */
278283 public function getParameterFilterWidgets (
279284 $ arrIds ,
0 commit comments