|
@@ 398-416 (lines=19) @@
|
| 395 |
|
* |
| 396 |
|
* @return string |
| 397 |
|
*/ |
| 398 |
|
private function renderDynamicPageView(TemplateInterface &$template, TemplateReadyDocument &$twigItem) |
| 399 |
|
{ |
| 400 |
|
$defaultContext = [ |
| 401 |
|
'this' => $twigItem->createJail(), |
| 402 |
|
]; |
| 403 |
|
|
| 404 |
|
$preEvent = new CompileProcessPreRenderPageView(BasePageView::DYNAMIC_TYPE); |
| 405 |
|
$this->eventDispatcher->dispatch(CompileProcessPreRenderPageView::NAME, $preEvent); |
| 406 |
|
|
| 407 |
|
$context = array_merge($preEvent->getCustomVariables(), $defaultContext); |
| 408 |
|
$output = $template |
| 409 |
|
->render($context) |
| 410 |
|
; |
| 411 |
|
|
| 412 |
|
$postEvent = new CompileProcessPostRenderPageView(BasePageView::DYNAMIC_TYPE, $output); |
| 413 |
|
$this->eventDispatcher->dispatch(CompileProcessPostRenderPageView::NAME, $postEvent); |
| 414 |
|
|
| 415 |
|
return $postEvent->getCompiledOutput(); |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
/** |
| 419 |
|
* Get the compiled HTML for a static PageView. |
|
@@ 427-446 (lines=20) @@
|
| 424 |
|
* |
| 425 |
|
* @return string |
| 426 |
|
*/ |
| 427 |
|
private function renderStaticPageView(StaticPageView &$pageView) |
| 428 |
|
{ |
| 429 |
|
$defaultContext = [ |
| 430 |
|
'this' => $pageView->createJail(), |
| 431 |
|
]; |
| 432 |
|
|
| 433 |
|
$preEvent = new CompileProcessPreRenderPageView(BasePageView::STATIC_TYPE); |
| 434 |
|
$this->eventDispatcher->dispatch(CompileProcessPreRenderPageView::NAME, $preEvent); |
| 435 |
|
|
| 436 |
|
$context = array_merge($preEvent->getCustomVariables(), $defaultContext); |
| 437 |
|
$output = $this |
| 438 |
|
->createTwigTemplate($pageView) |
| 439 |
|
->render($context) |
| 440 |
|
; |
| 441 |
|
|
| 442 |
|
$postEvent = new CompileProcessPostRenderPageView(BasePageView::STATIC_TYPE, $output); |
| 443 |
|
$this->eventDispatcher->dispatch(CompileProcessPostRenderPageView::NAME, $postEvent); |
| 444 |
|
|
| 445 |
|
return $postEvent->getCompiledOutput(); |
| 446 |
|
} |
| 447 |
|
|
| 448 |
|
/** |
| 449 |
|
* Create a Twig template that just needs an array to render. |