loadStartPage() public method

returns the data from the given id.
public loadStartPage ( string $webspaceKey, string $languageCode ) : Sulu\Component\Content\Compat\StructureInterface
$webspaceKey string Key of webspace
$languageCode string Read data for given language
return Sulu\Component\Content\Compat\StructureInterface
Ejemplo n.º 1
0
 /**
  * Start preview session.
  *
  * @param ConnectionInterface   $conn
  * @param MessageHandlerContext $context
  * @param array                 $msg
  *
  * @return array
  *
  * @throws MissingParameterException
  */
 private function start(ConnectionInterface $conn, MessageHandlerContext $context, $msg)
 {
     // locale
     if (!array_key_exists('locale', $msg)) {
         throw new MissingParameterException('locale');
     }
     $locale = $msg['locale'];
     $context->set('locale', $locale);
     // webspace key
     if (!array_key_exists('webspaceKey', $msg)) {
         throw new MissingParameterException('webspaceKey');
     }
     $webspaceKey = $msg['webspaceKey'];
     $context->set('webspaceKey', $webspaceKey);
     // user id
     if (!array_key_exists('user', $msg)) {
         throw new MissingParameterException('user');
     }
     $user = $msg['user'];
     $context->set('user', $user);
     // content uuid
     if (!array_key_exists('content', $msg)) {
         throw new MissingParameterException('content');
     }
     $contentUuid = $msg['content'];
     // filter index page
     if ($contentUuid === 'index') {
         $startPage = $this->contentMapper->loadStartPage($webspaceKey, $locale);
         $contentUuid = $startPage->getUuid();
     }
     $context->set('content', $contentUuid);
     // init message vars
     $template = array_key_exists('template', $msg) ? $msg['template'] : null;
     $data = array_key_exists('data', $msg) ? $msg['data'] : null;
     // start preview
     $this->preview->start($user, $contentUuid, $webspaceKey, $locale, $data, $template);
     return ['command' => 'start', 'content' => $contentUuid, 'msg' => 'OK'];
 }
Ejemplo n.º 2
0
 private function copyNodes($webspaceKey, $srcLocale, $destLocale, $overwrite)
 {
     $node = $this->contentMapper->loadStartPage($webspaceKey, $srcLocale);
     // copy start node
     $this->copyNodeRecursive($node, $webspaceKey, $srcLocale, $destLocale, $overwrite);
 }