class Template

Template.

Constants

LayerTop

LayerSnippet

LayerLocal

ContentType

Blocks

Properties

$global

global accumulators for intermediate results

protected array $params
protected $filters
protected internal $parentName
protected array[] $varStack
protected Block[][] $blocks

Methods

__construct(Engine $engine, array $params, FilterExecutor $filters, array $providers, string $name)

No description

getEngine()

No description

string
getName()

No description

array
getParameters()

Returns array of all parameters.

array
getBlockNames(int|string $layer = self::LayerTop)

No description

string|null
getParentName()

No description

Template|null
getReferringTemplate()

No description

string|null
getReferenceType()

No description

void
render(string|null $block = null)

Renders template.

createTemplate(string $name, array $params, string $referenceType)

Renders template.

void
renderToContentType(string|Closure|null $mod, string|null $block = null)

No description

array
prepare()

No description

void
main(array $params)

No description

void
renderBlock(string $name, array $params, string|Closure|null $mod = null, int|string|null $layer = null)

Renders block.

void
renderBlockParent(string $name, array $params)

Renders parent block.

void
addBlock(string $name, string $contentType, array $functions, int|string|null $layer = null)

Creates block if doesn't exist and checks if content type is the same.

string
capture(callable $function)

Captures output to string.

void
enterBlockLayer(int $staticId, array $vars)

No description

void
copyBlockLayer()

No description

void
leaveBlockLayer()

No description

bool
hasBlock(string $name)

No description

Details

at line 63
__construct(Engine $engine, array $params, FilterExecutor $filters, array $providers, string $name)

No description

Parameters

Engine $engine
array $params
FilterExecutor $filters
array $providers
string $name

at line 81
Engine getEngine()

No description

Return Value

Engine

at line 87
string getName()

No description

Return Value

string

at line 97
array getParameters()

Returns array of all parameters.

Return Value

array

at line 106
array getBlockNames(int|string $layer = self::LayerTop)

No description

Parameters

int|string $layer

Return Value

array

at line 112
string|null getParentName()

No description

Return Value

string|null

at line 118
Template|null getReferringTemplate()

No description

Return Value

Template|null

at line 124
string|null getReferenceType()

No description

Return Value

string|null

at line 134
void render(string|null $block = null)

internal  
 

Renders template.

Parameters

string|null $block

Return Value

void

at line 167
Template createTemplate(string $name, array $params, string $referenceType)

internal  
 

Renders template.

Parameters

string $name
array $params
string $referenceType

Return Value

Template

at line 198
void renderToContentType(string|Closure|null $mod, string|null $block = null)

internal  
 

No description

Parameters

string|Closure|null $mod

content-type name or modifier closure

string|null $block

Return Value

void

at line 210
array prepare()

No description

Return Value

array

at line 217
void main(array $params)

No description

Parameters

array $params

Return Value

void

at line 231
void renderBlock(string $name, array $params, string|Closure|null $mod = null, int|string|null $layer = null)

internal  
 

Renders block.

Parameters

string $name
array $params
string|Closure|null $mod

content-type name or modifier closure

int|string|null $layer

Return Value

void

at line 263
void renderBlockParent(string $name, array $params)

internal  
 

Renders parent block.

Parameters

string $name
array $params

Return Value

void

at line 279
protected void addBlock(string $name, string $contentType, array $functions, int|string|null $layer = null)

internal  
 

Creates block if doesn't exist and checks if content type is the same.

Parameters

string $name
string $contentType
array $functions
int|string|null $layer

Return Value

void

at line 330
string capture(callable $function)

internal  
 

Captures output to string.

Parameters

callable $function

Return Value

string

at line 354
protected void enterBlockLayer(int $staticId, array $vars)

No description

Parameters

int $staticId
array $vars

Return Value

void

at line 362
protected void copyBlockLayer()

No description

Return Value

void

at line 370
protected void leaveBlockLayer()

No description

Return Value

void

at line 377
bool hasBlock(string $name)

No description

Parameters

string $name

Return Value

bool

Traits

Better OOP experience.