|
@@ 483-501 (lines=19) @@
|
| 480 |
|
* |
| 481 |
|
* @return string |
| 482 |
|
*/ |
| 483 |
|
private function buildDynamicPageViewHTML(TemplateInterface &$template, &$twigItem) |
| 484 |
|
{ |
| 485 |
|
$defaultContext = [ |
| 486 |
|
'this' => $twigItem->createJail(), |
| 487 |
|
]; |
| 488 |
|
|
| 489 |
|
$preEvent = new CompilerPreRenderDynamicPageView($twigItem); |
| 490 |
|
$this->eventDispatcher->dispatch(CompilerPreRenderDynamicPageView::NAME, $preEvent); |
| 491 |
|
|
| 492 |
|
$context = array_merge($preEvent->getCustomVariables(), $defaultContext); |
| 493 |
|
$output = $template |
| 494 |
|
->render($context) |
| 495 |
|
; |
| 496 |
|
|
| 497 |
|
$postEvent = new CompilerPostRenderDynamicPageView($twigItem, $output); |
| 498 |
|
$this->eventDispatcher->dispatch(CompilerPostRenderDynamicPageView::NAME, $postEvent); |
| 499 |
|
|
| 500 |
|
return $postEvent->getCompiledOutput(); |
| 501 |
|
} |
| 502 |
|
|
| 503 |
|
/** |
| 504 |
|
* Get the compiled HTML for a static PageView. |
|
@@ 512-531 (lines=20) @@
|
| 509 |
|
* |
| 510 |
|
* @return string |
| 511 |
|
*/ |
| 512 |
|
private function buildStaticPageViewHTML(StaticPageView &$pageView) |
| 513 |
|
{ |
| 514 |
|
$defaultContext = [ |
| 515 |
|
'this' => $pageView->createJail(), |
| 516 |
|
]; |
| 517 |
|
|
| 518 |
|
$preEvent = new CompilerPreRenderStaticPageView($pageView); |
| 519 |
|
$this->eventDispatcher->dispatch(CompilerPreRenderStaticPageView::NAME, $preEvent); |
| 520 |
|
|
| 521 |
|
$context = array_merge($preEvent->getCustomVariables(), $defaultContext); |
| 522 |
|
$output = $this |
| 523 |
|
->createTwigTemplate($pageView) |
| 524 |
|
->render($context) |
| 525 |
|
; |
| 526 |
|
|
| 527 |
|
$postEvent = new CompilerPostRenderStaticPageView($pageView, $output); |
| 528 |
|
$this->eventDispatcher->dispatch(CompilerPostRenderStaticPageView::NAME, $postEvent); |
| 529 |
|
|
| 530 |
|
return $postEvent->getCompiledOutput(); |
| 531 |
|
} |
| 532 |
|
|
| 533 |
|
/** |
| 534 |
|
* Create a Twig template that just needs an array to render. |