1 | <?php |
||
25 | abstract class AbstractFacet |
||
26 | { |
||
27 | const TYPE_ABSTRACT = 'abstract'; |
||
28 | |||
29 | /** |
||
30 | * String |
||
31 | * @var string |
||
32 | */ |
||
33 | protected static $type = self::TYPE_ABSTRACT; |
||
34 | |||
35 | /** |
||
36 | * The resultSet where this facet belongs to. |
||
37 | * |
||
38 | * @var SearchResultSet |
||
39 | */ |
||
40 | protected $resultSet = null; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $name; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $field; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $label; |
||
56 | |||
57 | /** |
||
58 | * @var [] |
||
59 | */ |
||
60 | protected $configuration; |
||
61 | |||
62 | /** |
||
63 | * @var boolean |
||
64 | */ |
||
65 | protected $isAvailable = false; |
||
66 | |||
67 | /** |
||
68 | * @var bool |
||
69 | */ |
||
70 | protected $isUsed = false; |
||
71 | |||
72 | /** |
||
73 | * @var bool |
||
74 | */ |
||
75 | protected $allRequirementsMet = true; |
||
76 | |||
77 | /** |
||
78 | * AbstractFacet constructor. |
||
79 | * |
||
80 | * @param SearchResultSet $resultSet |
||
81 | 80 | * @param string $name |
|
82 | * @param string $field |
||
83 | 80 | * @param string $label |
|
84 | 80 | * @param array $configuration Facet configuration passed from typoscript |
|
85 | 80 | */ |
|
86 | 80 | public function __construct(SearchResultSet $resultSet, $name, $field, $label = '', array $configuration = []) |
|
94 | |||
95 | 52 | /** |
|
96 | * Get name |
||
97 | 52 | * |
|
98 | * @return string |
||
99 | */ |
||
100 | public function getName() |
||
104 | |||
105 | /** |
||
106 | * Get solr field name |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | public function getField() |
||
114 | |||
115 | /** |
||
116 | * @param string $label |
||
117 | */ |
||
118 | public function setLabel($label) |
||
122 | |||
123 | 24 | /** |
|
124 | * @return string |
||
125 | */ |
||
126 | public function getLabel() |
||
130 | |||
131 | 54 | /** |
|
132 | 54 | * @param boolean $isAvailable |
|
133 | */ |
||
134 | public function setIsAvailable($isAvailable) |
||
138 | |||
139 | 23 | /** |
|
140 | * @return boolean |
||
141 | */ |
||
142 | public function getIsAvailable() |
||
146 | |||
147 | 54 | /** |
|
148 | 54 | * @param boolean $isUsed |
|
149 | */ |
||
150 | public function setIsUsed($isUsed) |
||
154 | |||
155 | 29 | /** |
|
156 | * @return boolean |
||
157 | */ |
||
158 | public function getIsUsed() |
||
162 | |||
163 | 21 | /** |
|
164 | * @return string |
||
165 | */ |
||
166 | public function getType() |
||
170 | |||
171 | 23 | /** |
|
172 | * @return boolean |
||
173 | */ |
||
174 | public function getAllRequirementsMet() |
||
178 | |||
179 | 2 | /** |
|
180 | * @param boolean $allRequirementsMet |
||
181 | 2 | */ |
|
182 | public function setAllRequirementsMet($allRequirementsMet) |
||
186 | |||
187 | /** |
||
188 | * @return SearchResultSet |
||
189 | */ |
||
190 | public function getResultSet() |
||
194 | |||
195 | /** |
||
196 | * Get configuration |
||
197 | 24 | * |
|
198 | * @return mixed |
||
199 | 24 | */ |
|
200 | public function getConfiguration() |
||
204 | |||
205 | /** |
||
206 | * Get facet partial name used for rendering the facet |
||
207 | * |
||
208 | 28 | * @return string |
|
209 | */ |
||
210 | 28 | public function getPartialName() |
|
214 | |||
215 | /** |
||
216 | * @return string |
||
217 | */ |
||
218 | public function getGroupName() |
||
222 | 4 | ||
223 | /** |
||
224 | * Indicates if this facet should ne included in the available facets. When nothing is configured, |
||
225 | * the method return TRUE. |
||
226 | * |
||
227 | * @return boolean |
||
228 | */ |
||
229 | public function getIncludeInAvailableFacets() |
||
233 | |||
234 | /** |
||
235 | * Indicates if this facets should be included in the used facets. When nothing is configured, |
||
236 | * the methods returns true. |
||
237 | 29 | * |
|
238 | * @return boolean |
||
239 | 29 | */ |
|
240 | 22 | public function getIncludeInUsedFacets() |
|
245 | |||
246 | /** |
||
247 | * Returns the configured requirements |
||
248 | * |
||
249 | * @return array |
||
250 | */ |
||
251 | public function getRequirements() |
||
255 | |||
256 | /** |
||
257 | * The implementation of this method should return a "flatten" collection of all items. |
||
258 | * |
||
259 | * @return AbstractFacetItemCollection |
||
260 | */ |
||
261 | abstract public function getAllFacetItems(); |
||
262 | |||
263 | /** |
||
264 | * @param string $key |
||
265 | * @param mixed $defaultValue |
||
266 | * @return mixed |
||
267 | */ |
||
268 | protected function getFacetSettingOrDefaultValue($key, $defaultValue) |
||
276 | } |
||
277 |