/** * {@inheritdoc} * * @param BasePageDocument $object */ public function setContext($object, $locale, array $context) { if (array_key_exists('template', $context)) { $object->setStructureType($context['template']); } return $object; }
/** * Returns a flat array with the settings of the given document. * * @param BasePageDocument $document * @param string $format * * @return array */ protected function getSettingData(BasePageDocument $document, $format) { if ($created = $document->getCreated()) { $created = $created->format('c'); } if ($changed = $document->getChanged()) { $changed = $changed->format('c'); } if ($published = $document->getPublished()) { $published = $published->format('c'); } $settingOptions = []; if ($format === '1.2.xliff') { $settingOptions = ['translate' => false]; } return ['structureType' => $this->createProperty('structureType', $document->getStructureType(), $settingOptions), 'published' => $this->createProperty('published', $published, $settingOptions), 'created' => $this->createProperty('created', $created, $settingOptions), 'changed' => $this->createProperty('changed', $changed, $settingOptions), 'creator' => $this->createProperty('creator', $document->getCreator(), $settingOptions), 'changer' => $this->createProperty('changer', $document->getChanger(), $settingOptions), 'locale' => $this->createProperty('locale', $document->getLocale(), $settingOptions), 'navigationContexts' => $this->createProperty('navigationContexts', json_encode($document->getNavigationContexts()), $settingOptions), 'permissions' => $this->createProperty('permissions', json_encode($document->getPermissions()), $settingOptions), 'shadowLocale' => $this->createProperty('shadowLocale', $document->getShadowLocale(), $settingOptions), 'originalLocale' => $this->createProperty('originalLocale', $document->getOriginalLocale(), $settingOptions), 'resourceSegment' => $this->createProperty('resourceSegment', $document->getResourceSegment(), $settingOptions), 'webspaceName' => $this->createProperty('webspaceName', $document->getWebspaceName(), $settingOptions), 'redirectExternal' => $this->createProperty('redirectExternal', $document->getRedirectExternal(), $settingOptions), 'redirectType' => $this->createProperty('redirectType', $document->getRedirectType(), $settingOptions), 'redirectTarget' => $this->createProperty('redirectTarget', $document->getRedirectTarget(), $settingOptions), 'workflowStage' => $this->createProperty('workflowStage', $document->getWorkflowStage(), $settingOptions), 'path' => $this->createProperty('path', $document->getPath(), $settingOptions)]; }