/** * Structures are updated according to their xml definition. * * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise */ private function iterateStructures($addScheme) { $properties = []; // find templates containing URL fields $structureMetadatas = array_merge($this->structureMetadataFactory->getStructures('page'), $this->structureMetadataFactory->getStructures('snippet')); $structureMetadatas = array_filter($structureMetadatas, function (StructureMetadata $structureMetadata) use(&$properties) { $structureName = $structureMetadata->getName(); $this->findUrlProperties($structureMetadata, $properties); return !empty($properties[$structureName]) || !empty($blockProperties[$structureName]); }); foreach ($structureMetadatas as $structureMetadata) { $this->iterateStructureNodes($structureMetadata, $properties[$structureMetadata->getName()], $addScheme); } $this->documentManager->flush(); }
/** * Structures are updated according to their xml definition. * * @param bool $up Indicates that this is up or down */ private function iterateStructures($up) { $properties = []; // find templates containing date fields $structureMetadatas = array_merge($this->structureMetadataFactory->getStructures('page'), $this->structureMetadataFactory->getStructures('snippet')); $structureMetadatas = array_filter($structureMetadatas, function (StructureMetadata $structureMetadata) use(&$properties) { $structureName = $structureMetadata->getName(); $this->findDateProperties($structureMetadata, $properties); return !empty($properties[$structureName]) || !empty($blockProperties[$structureName]); }); foreach ($structureMetadatas as $structureMetadata) { $this->iterateStructureNodes($structureMetadata, $properties[$structureMetadata->getName()], $up); } $this->session->save(); }
/** * {@inheritdoc} * * This function wont work for website mode. * To enable this the object would have to loaded in case the argument $object is null. */ public function getByEntity($entityClass, $id, $locale, $object = null) { $metadata = $this->structureMetadataFactory->getStructureMetadata('page', $object->getStructureType()); return ['_controller' => $metadata->controller, 'view' => $metadata->view, 'object' => $object, 'structure' => $this->documentToStructure($object)]; }