Neos\Fusion\Core\Runtime::pushContext PHP Метод

pushContext() публичный Метод

Push a new context object to the rendering stack
public pushContext ( string $key, mixed $context ) : void
$key string the key inside the context
$context mixed
Результат void
    public function pushContext($key, $context)
    {
        $newContext = $this->getCurrentContext();
        $newContext[$key] = $context;
        $this->renderingStack[] = $newContext;
    }

Usage Example

 /**
  * @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'));
 }
All Usage Examples Of Neos\Fusion\Core\Runtime::pushContext