1
|
|
|
<?php |
2
|
|
|
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Backend\Document; |
3
|
|
|
|
4
|
|
|
/*************************************************************** |
5
|
|
|
* Copyright notice |
6
|
|
|
* |
7
|
|
|
* (c) 2017 Rafael Kähm <[email protected]> |
8
|
|
|
* All rights reserved |
9
|
|
|
* |
10
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
11
|
|
|
* free software; you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU General Public License as published by |
13
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
14
|
|
|
* (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* The GNU General Public License can be found at |
17
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
18
|
|
|
* |
19
|
|
|
* This script is distributed in the hope that it will be useful, |
20
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
|
|
|
* GNU General Public License for more details. |
23
|
|
|
* |
24
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
25
|
|
|
***************************************************************/ |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Condition for checking if type is a string. |
32
|
|
|
*/ |
33
|
|
|
class IsBoostedFieldViewHelper extends AbstractConditionViewHelper |
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Initialize ViewHelper arguments |
38
|
|
|
* |
39
|
|
|
* @return void |
40
|
|
|
*/ |
41
|
|
|
public function initializeArguments() |
42
|
|
|
{ |
43
|
|
|
parent::initializeArguments(); |
44
|
|
|
$this->registerArgument('fieldName', 'string', 'Fieldname to be verified.', true); |
45
|
|
|
$this->registerArgument('document', '\Apache_Solr_Document', '\Apache_Solr_Document to be verified.', true); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* This method decides if the condition is true or false |
50
|
|
|
* |
51
|
|
|
* @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper. |
52
|
|
|
* @return bool |
53
|
|
|
*/ |
54
|
2 |
|
protected static function evaluateCondition($arguments = null) |
55
|
|
|
{ |
56
|
|
|
/* @var $document \Apache_Solr_Document */ |
57
|
2 |
|
$document = $arguments['document']; |
58
|
2 |
|
return $document->getFieldBoost($arguments['fieldName']); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|