1 | <?php |
||
32 | class FlexFormUserFunctions |
||
33 | { |
||
34 | /** |
||
35 | * Provides all facet fields for a flexform select, enabling the editor to select one of them. |
||
36 | * |
||
37 | * @param array $parentInformation |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | 3 | public function getFacetFieldsFromSchema(array &$parentInformation) |
|
54 | |||
55 | /** |
||
56 | * This method parses the solr schema fields into the required format for the backend flexform. |
||
57 | * |
||
58 | * @param array $configuredFacets |
||
59 | * @param array $pageRecord |
||
60 | * @return mixed |
||
61 | */ |
||
62 | 2 | protected function getParsedSolrFieldsFromSchema($configuredFacets, $pageRecord) |
|
63 | { |
||
64 | 2 | $newItems = []; |
|
65 | |||
66 | 2 | array_map(function($fieldName) use (&$newItems, $configuredFacets) { |
|
67 | 2 | $value = $fieldName; |
|
68 | 2 | $label = $fieldName; |
|
69 | |||
70 | 2 | $facetNameFilter = function($facet) use ($fieldName) { |
|
71 | 1 | return ($facet['field'] === $fieldName); |
|
72 | 2 | }; |
|
73 | 2 | $configuredFacets = array_filter($configuredFacets, $facetNameFilter); |
|
|
|||
74 | 2 | if (!empty($configuredFacets)) { |
|
75 | 1 | $configuredFacet = array_values($configuredFacets); |
|
76 | 1 | $label = $configuredFacet[0]['label']; |
|
77 | } |
||
78 | |||
79 | 2 | $newItems[$label] = [$label, $value]; |
|
80 | 2 | }, $this->getFieldNamesFromSolrMetaDataForPage($pageRecord)); |
|
81 | |||
82 | 2 | ksort($newItems, SORT_NATURAL); |
|
83 | 2 | return $newItems; |
|
84 | } |
||
85 | /** |
||
86 | * Retrieves the configured facets for a page. |
||
87 | * |
||
88 | * @param integer $pid |
||
89 | * @return array |
||
90 | */ |
||
91 | protected function getConfiguredFacetsForPage($pid) |
||
96 | |||
97 | /** |
||
98 | * Get solr connection. |
||
99 | * |
||
100 | * @param array $pageRecord |
||
101 | * |
||
102 | * @return \ApacheSolrForTypo3\Solr\SolrService |
||
103 | */ |
||
104 | protected function getConnection(array $pageRecord) |
||
108 | |||
109 | /** |
||
110 | * Retrieves all fieldnames that occure in the solr schema for one page. |
||
111 | * |
||
112 | * @param array $pageRecord |
||
113 | * @return array |
||
114 | */ |
||
115 | protected function getFieldNamesFromSolrMetaDataForPage(array $pageRecord) |
||
119 | |||
120 | /** |
||
121 | * @param array $parentInformation |
||
122 | */ |
||
123 | 1 | public function getAvailableTemplates(array &$parentInformation) |
|
139 | |||
140 | /** |
||
141 | * @param array $parentInformation |
||
142 | * @return string |
||
143 | */ |
||
144 | 1 | protected function getTypoScriptTemplateKeyFromFieldName(array &$parentInformation) |
|
149 | |||
150 | /** |
||
151 | * @param $pid |
||
152 | * @return \ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration|array |
||
153 | */ |
||
154 | protected function getConfigurationFromPageId($pid) |
||
159 | |||
160 | /** |
||
161 | * Retrieves the configured templates from TypoScript. |
||
162 | * |
||
163 | * @param integer $pageId |
||
164 | * @param string $templateKey |
||
165 | * @return array |
||
166 | */ |
||
167 | protected function getAvailableTemplateFromTypoScriptConfiguration($pageId, $templateKey) |
||
172 | |||
173 | /** |
||
174 | * Returns the available templates as needed for the flexform. |
||
175 | * |
||
176 | * @param array $availableTemplates |
||
177 | * @return array |
||
178 | */ |
||
179 | 1 | protected function buildSelectItemsFromAvailableTemplate($availableTemplates) |
|
191 | } |
||
192 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope