- Added an event manager. Also, fixed some more bugs within Block and Section tokens
This commit is contained in:
1 parent
58f73d914b
commit
08211282c2
14 files changed
+164
-18
No files matched your search
@@ -8,10 +8,13 @@ namespace %NAMESPACE%;
|
||||
if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
class %CLASSNAME% %EXTENDS% {
|
||||
|
||||
public array $blockList = [];
|
||||
|
||||
public array $sectionList = [];
|
||||
|
||||
public array $sectionStack = [];
|
||||
|
||||
public array $variableList = [];
|
||||
|
||||
public ?object $thisProxy = null;
|
||||
@@ -24,6 +27,8 @@ if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
public bool $renderingInsideSection = false;
|
||||
|
||||
public int $depth = 0;
|
||||
|
||||
public function __construct(\Picea\Picea $picea, array $variablesList = [], ?object $thisProxy = null) {
|
||||
$this->picea = $picea;
|
||||
$this->variableList = $variablesList;
|
||||
@@ -37,15 +42,26 @@ if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
public function output(array $variablesList = []) : void
|
||||
{
|
||||
$__event = new \Picea\Builder\ClassTemplateEvent();
|
||||
|
||||
$this->rendering = true;
|
||||
|
||||
( function($___class__template, $___global_variables, $___variables, $picea) {
|
||||
$this->depth++;
|
||||
|
||||
$__event->eventExecute(\Picea\Event\Builder\ClassTemplateOutputing::class, $variablesList);
|
||||
|
||||
( function($___class__template, $___global_variables, $___variables, $__event, $picea) {
|
||||
extract($___global_variables);
|
||||
extract($___variables, \EXTR_OVERWRITE);
|
||||
?>%CONTENT%<?php
|
||||
} )->call($this->thisProxy ?? new class(){}, $this, $this->variableList, $variablesList, $this->picea);
|
||||
} )->call($this->thisProxy ?? new class() {}, $this, $this->variableList, $variablesList, $__event, $this->picea);
|
||||
|
||||
$__event->eventExecute(\Picea\Event\Builder\ClassTemplateOutputDone::class, $variablesList);
|
||||
|
||||
%PARENT_OUTPUT%
|
||||
|
||||
$this->depth--;
|
||||
|
||||
$this->rendering = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user