/** * {@inheritdoc} */ public function generate($parts, $parentUuid, $uuid, $webspaceKey, $languageCode, $templateKey, $segmentKey = null) { /** @var StructureInterface $structure */ $structure = $this->structureManager->getStructure($templateKey); $title = $this->implodeRlpParts($structure, $parts); if ($parentUuid !== null) { $parentPath = $this->strategy->loadByContentUuid($parentUuid, $webspaceKey, $languageCode, $segmentKey); $result = $this->strategy->generate($title, $parentPath, $webspaceKey, $languageCode, $segmentKey); } elseif ($uuid !== null) { $result = $this->strategy->generateForUuid($title, $uuid, $webspaceKey, $languageCode, $segmentKey); } else { $parentPath = '/'; $result = $this->strategy->generate($title, $parentPath, $webspaceKey, $languageCode, $segmentKey); } return ['resourceLocator' => $result, '_links' => ['self' => $this->getBasePath() . '/generates']]; }
private function initHistory($webspaceKey, $locale) { $this->initPhpcr(); $contentNode = $this->sessionManager->getContentNode($webspaceKey); $this->phpcrStrategy->save($contentNode, '/team', 1, $webspaceKey, $locale); $this->phpcrStrategy->save($contentNode, '/team/daniel', 1, $webspaceKey, $locale); $this->phpcrStrategy->save($contentNode, '/team/johannes', 1, $webspaceKey, $locale); $this->phpcrStrategy->save($contentNode, '/about-us', 1, $webspaceKey, $locale); $this->phpcrStrategy->move('/team', '/my-test', $contentNode, 1, $webspaceKey, $locale); $session = $this->sessionManager->getSession(); $session->save(); $session->refresh(false); }
/** * TODO: Move this to ResourceLocator repository> * * {@inheritdoc} */ public function restoreHistoryPath($path, $userId, $webspaceKey, $locale, $segmentKey = null) { $this->strategy->restoreByPath($path, $webspaceKey, $locale, $segmentKey); $content = $this->loadByResourceLocator($path, $webspaceKey, $locale, $segmentKey); $property = $content->getPropertyByTagName('sulu.rlp'); $property->setValue($path); $node = $this->sessionManager->getSession()->getNodeByIdentifier($content->getUuid()); $contentType = $this->contentTypeManager->get($property->getContentTypeName()); $contentType->write($node, new TranslatedProperty($property, $locale, $this->namespaceRegistry->getPrefix('content_localized')), $userId, $webspaceKey, $locale, $segmentKey); $this->sessionManager->getSession()->save(); }