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 | * AbstractFacet constructor. |
||
74 | * |
||
75 | * @param SearchResultSet $resultSet |
||
76 | * @param string $name |
||
77 | * @param string $field |
||
78 | * @param string $label |
||
79 | * @param array $configuration Facet configuration passed from typoscript |
||
80 | */ |
||
81 | 80 | public function __construct(SearchResultSet $resultSet, $name, $field, $label = '', array $configuration = []) |
|
89 | |||
90 | /** |
||
91 | * Get name |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | 52 | public function getName() |
|
99 | |||
100 | /** |
||
101 | * Get solr field name |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public function getField() |
||
109 | |||
110 | /** |
||
111 | * @param string $label |
||
112 | */ |
||
113 | public function setLabel($label) |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | 24 | public function getLabel() |
|
125 | |||
126 | /** |
||
127 | * @param boolean $isAvailable |
||
128 | */ |
||
129 | 54 | public function setIsAvailable($isAvailable) |
|
133 | |||
134 | /** |
||
135 | * @return boolean |
||
136 | */ |
||
137 | 23 | public function getIsAvailable() |
|
141 | |||
142 | /** |
||
143 | * @param boolean $isUsed |
||
144 | */ |
||
145 | 54 | public function setIsUsed($isUsed) |
|
149 | |||
150 | /** |
||
151 | * @return boolean |
||
152 | */ |
||
153 | 29 | public function getIsUsed() |
|
157 | |||
158 | /** |
||
159 | * @return string |
||
160 | */ |
||
161 | 21 | public function getType() |
|
165 | |||
166 | /** |
||
167 | * @return SearchResultSet |
||
168 | */ |
||
169 | 23 | public function getResultSet() |
|
173 | |||
174 | /** |
||
175 | * Get configuration |
||
176 | * |
||
177 | * @return mixed |
||
178 | */ |
||
179 | 2 | public function getConfiguration() |
|
183 | |||
184 | /** |
||
185 | * Get facet partial name used for rendering the facet |
||
186 | * |
||
187 | * @return string |
||
188 | */ |
||
189 | public function getPartialName() |
||
193 | |||
194 | /** |
||
195 | * @return string |
||
196 | */ |
||
197 | 24 | public function getGroupName() |
|
201 | |||
202 | /** |
||
203 | * Indicates if this facet should ne included in the available facets. When nothing is configured, |
||
204 | * the method return TRUE. |
||
205 | * |
||
206 | * @return boolean |
||
207 | */ |
||
208 | 28 | public function getIncludeInAvailableFacets() |
|
212 | |||
213 | /** |
||
214 | * Indicates if this facets should be included in the used facets. When nothing is configured, |
||
215 | * the methods returns true. |
||
216 | * |
||
217 | * @return boolean |
||
218 | */ |
||
219 | 4 | public function getIncludeInUsedFacets() |
|
224 | |||
225 | /** |
||
226 | * The implementation of this method should return a "flatten" collection of all items. |
||
227 | * |
||
228 | * @return AbstractFacetItemCollection |
||
229 | */ |
||
230 | abstract public function getAllFacetItems(); |
||
231 | |||
232 | /** |
||
233 | * @param string $key |
||
234 | * @param mixed $defaultValue |
||
235 | * @return mixed |
||
236 | */ |
||
237 | 29 | protected function getFacetSettingOrDefaultValue($key, $defaultValue) |
|
245 | } |
||
246 |