1 | <?php |
||
56 | class PageUidToHierarchy extends AbstractHierarchyProcessor implements FieldProcessor |
||
57 | { |
||
58 | |||
59 | /** |
||
60 | * Expects a page ID of a page. Returns a Solr hierarchy notation for the |
||
61 | * rootline of the page ID. |
||
62 | * |
||
63 | * @param array $values Array of values, an array because of multivalued fields |
||
64 | * @return array Modified array of values |
||
65 | */ |
||
66 | 53 | public function process(array $values) |
|
67 | { |
||
68 | 53 | $results = []; |
|
69 | |||
70 | 53 | foreach ($values as $value) { |
|
71 | 53 | list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',', |
|
72 | 53 | $value, true, 2); |
|
73 | 53 | $results[] = $this->getSolrRootlineForPageId($rootPageUid, |
|
74 | 53 | $mountPoint); |
|
75 | } |
||
76 | |||
77 | 53 | return $results; |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * Returns a Solr hierarchy notation string for rootline of given PID. |
||
82 | * |
||
83 | * @param int $pageId Page ID to get a rootline as Solr hierarchy for |
||
84 | * @param string $mountPoint The mount point parameter that will be used for building the rootline. |
||
85 | * @return string Rootline as Solr hierarchy |
||
86 | */ |
||
87 | 53 | protected function getSolrRootlineForPageId($pageId, $mountPoint = '') |
|
94 | |||
95 | /** |
||
96 | * Builds a page's rootline of parent page Ids |
||
97 | * |
||
98 | * @param int $pageId The page Id to build the rootline for |
||
99 | * @param string $mountPoint The mount point parameter that will be passed to getRootline(). |
||
100 | * @return array Page Id rootline as array |
||
101 | */ |
||
102 | 53 | protected function buildPageIdRootline($pageId, $mountPoint = '') |
|
122 | } |
||
123 |