urlBuilder = $urlBuilder; $this->structureElementTypes = $structureElementTypes; } /** * @return array */ public function getAll() { return $this->results; } /** * @param StructureElementInterface $structureElement * @param string $elementPathLabel * @return void */ public function add(StructureElementInterface $structureElement, $elementPathLabel) { $urlParams = []; $elementData = $structureElement->getData(); if (!in_array($elementData['_elementType'], array_keys($this->structureElementTypes))) { return; } if (isset($this->structureElementTypes[$elementData['_elementType']])) { $urlParamsBuilder = $this->structureElementTypes[$elementData['_elementType']]; $urlParams = $urlParamsBuilder->build($structureElement); } $this->results[] = [ 'id' => $structureElement->getPath(), 'type' => null, 'name' => (string)$structureElement->getLabel(), 'description' => $elementPathLabel, 'url' => $this->urlBuilder->getUrl('*/system_config/edit', $urlParams), ]; } }