コード例 #1
0
 /**
  * @test
  */
 public function viewHelperRendersUriViaStringPointingToSubNodes()
 {
     $this->tsRuntime->pushContext('documentNode', $this->contentContext->getCurrentSiteNode()->getNode('home/about-us/mission'));
     $this->assertSame('<a href="/en/home/about-us/history.html">History</a>', $this->viewHelper->render('../history'));
     $this->tsRuntime->popContext();
     $this->assertSame('<a href="/en/home/about-us/our-mission.html">Our mission</a>', $this->viewHelper->render('about-us/mission'));
     $this->assertSame('<a href="/en/home/about-us/our-mission.html">Our mission</a>', $this->viewHelper->render('./about-us/mission'));
 }
コード例 #2
0
 /**
  * @test
  */
 public function viewHelperRendersUriViaStringPointingToSubNodes()
 {
     $this->tsRuntime->pushContext('documentNode', $this->contentContext->getCurrentSiteNode()->getNode('home/about-us/mission'));
     $this->assertOutputLinkValid('en/home/about-us/history.html', $this->viewHelper->render('../history'));
     $this->tsRuntime->popContext();
     $this->assertOutputLinkValid('en/home/about-us/our-mission.html', $this->viewHelper->render('about-us/mission'));
     $this->assertOutputLinkValid('en/home/about-us/our-mission.html', $this->viewHelper->render('./about-us/mission'));
 }
コード例 #3
0
 /**
  * Evaluate a TypoScript path with a given context without content caching
  *
  * This is used to render uncached segments "out of band" in getCachedSegment of ContentCache.
  *
  * @param string $path
  * @param array $contextArray
  * @return mixed
  *
  * TODO Find another way of disabling the cache (especially to allow cached content inside uncached content)
  */
 public function evaluateUncached($path, array $contextArray)
 {
     $previousEnableContentCache = $this->enableContentCache;
     $this->enableContentCache = FALSE;
     $this->runtime->pushContextArray($contextArray);
     $result = $this->runtime->evaluate($path);
     $this->runtime->popContext();
     $this->enableContentCache = $previousEnableContentCache;
     return $result;
 }
コード例 #4
0
 /**
  * Render the given TypoScript and return the rendered page
  *
  * @return string
  */
 protected function renderTypoScript()
 {
     $this->typoScriptRuntime->pushContextArray($this->variables);
     try {
         $output = $this->typoScriptRuntime->render($this->getTypoScriptPathForCurrentRequest());
     } catch (RuntimeException $exception) {
         throw $exception->getPrevious();
     }
     $this->typoScriptRuntime->popContext();
     return $output;
 }
コード例 #5
0
 /**
  * Renders the view
  *
  * @return string The rendered view
  * @throws \TYPO3\TYPO3\Exception if no node is given
  * @api
  */
 public function render()
 {
     $currentNode = isset($this->variables['value']) ? $this->variables['value'] : NULL;
     if (!$currentNode instanceof \TYPO3\TYPO3CR\Domain\Model\NodeInterface) {
         throw new \TYPO3\TYPO3\Exception('TypoScriptView needs a node as argument.', 1329736456);
     }
     // TODO: find closest folder node from this node...
     $closestFolderNode = $currentNode;
     $currentSiteNode = $this->nodeRepository->getContext()->getCurrentSiteNode();
     $typoScriptObjectTree = $this->typoScriptService->getMergedTypoScriptObjectTree($currentSiteNode, $closestFolderNode);
     $typoScriptRuntime = new Runtime($typoScriptObjectTree, $this->controllerContext);
     $typoScriptRuntime->pushContextArray(array('node' => $currentNode));
     $output = $typoScriptRuntime->render($this->typoScriptPath);
     $typoScriptRuntime->popContext();
     return $output;
 }