public function getContentPath(PathBehavior $document) { $path = $this->getPath($document); $webspaceKey = $this->getWebspace($document); return str_replace(sprintf('/%s/%s/%s', $this->pathSegmentRegistry->getPathSegment('base'), $webspaceKey, $this->pathSegmentRegistry->getPathSegment('content')), '', $path); }
/** * Adds the relative path to the serialization. * * @param ObjectEvent $event */ public function onPostSerialize(ObjectEvent $event) { $visitor = $event->getVisitor(); $document = $event->getObject(); if (!$document instanceof PathBehavior || !$this->documentRegistry->hasDocument($document)) { return; } $visitor->addData('path', $this->documentInspector->getContentPath($document)); }