Properties

$rootFolder

$rootFolder :mixed|string|null

internal root folder path

Type

mixed|string|null

$_extension

$_extension :null

Extension from functions.php

Type

null

$hook

$hook :null|object

An hook class instance, when defined

Type

null|object

Methods

__construct()

__construct(string  $path,string  $language = null)

Construct a new template object

Parameters

string $path

The name or the path to the template

string $language

The object language or null for raw one

Extension()

Extension(): null|object

Get extension Get an instance of the functions class next to the template

Returns

null|object

IsSystem()

IsSystem(): boolean

Is a system template?

Returns

boolean —

The status

DisableCdn()

DisableCdn(): boolean

Disable all cdn links in this template

Returns

boolean

Parent()

Parent(): \FAA\Obj\Generic\Template|null

Get the parent

When this instance has a parent template, load it and expose it as instance

Returns

\FAA\Obj\Generic\Template|null —

The parent or, null

Files()

Files(string|null  $sub_folder = null): array<mixed,\FAA\Obj\Sys\File>|null

List files of template

Function is available for custom templates only

Parameters

string|null $sub_folder

A relative sub folder path

Returns

array<mixed,\FAA\Obj\Sys\File>|null —

The list of files or, null when not accessible

Positions()

Positions(): array

List positions

Return an array of positions for dynamic contents that this template provides.

Returns

array

ExtensionJS()

ExtensionJS(): string|null

Path to admin extension js file

Returns

string|null

ToPlainObject()

ToPlainObject(string|null  $language = null,boolean  $with_parent = true): \stdClass

Convert to stdClass

Makes a plain object from this instance including the values of the index and the text index.

Parameters

string|null $language

The target translate language

boolean $with_parent

Resolve with parent instance

Returns

\stdClass —

The template contents

ContentSecurityPolicyHeader()

ContentSecurityPolicyHeader(): null|string

Get the csp header of the root template parent

Returns

null|string

GetHook()

GetHook(\FAA\Obj\Generic\Folder  $tree,\FAA\Obj\Request  $request): null|object

Get hook

Get an instance of the registered hook functions or, the parent hook of the template

Parameters

\FAA\Obj\Generic\Folder $tree

The called folder

\FAA\Obj\Request $request

The request context

Returns

null|object

GetCodeFilePath()

GetCodeFilePath(string  $name,string  $ext = 'html',integer  $depth): string

load template path abstract method to load the path to a file from assigned template object will return null if file not found or template not registered

Parameters

string $name

Name of the template file that

string $ext

File extension of searched template

integer $depth

Recursion depth secure flag

Returns

string —

Absolute path to the template or null if none was found

UploadFile()

UploadFile(  $target,  $data): \FAA\Obj\Result

Upload a file to this template folder

Parameters

$target
$data

Returns

\FAA\Obj\Result

EditFile()

EditFile(string  $_path,string  $content): \FAA\Obj\Result

Replace the content of a certain file in the template

Parameters

string $_path

Relative file path

string $content

The new content for the file

Returns

\FAA\Obj\Result —

A system result

DeleteFileOrFolder()

DeleteFileOrFolder(string  $_path): \FAA\Obj\Result

Delete file or folder inside of this template storage path

Parameters

string $_path

The relative path

Returns

\FAA\Obj\Result —

The result of the call

RenameFolder()

RenameFolder(array  $base,string  $name): \FAA\Obj\Result

Rename a template folder

Parameters

array $base

The root path relative to the template base path as array of path components

string $name

New name for the folder

Returns

\FAA\Obj\Result —

A system result object

AddFolder()

AddFolder(string  $base,string  $name): \FAA\Obj\Result

Add a template folder

Parameters

string $base

The root path relative to the template base path

string $name

New name for the folder

Returns

\FAA\Obj\Result —

A system result object

GetRootFolder()

GetRootFolder()

GetIndex()

GetIndex(  $type = 'html')

Parameters

$type

UpdateFile()

UpdateFile(string  $path,string  $file,string  $data): \FAA\Obj\Result|null

Update a file Create or update a template file of the template with given data

Parameters

string $path

Sub folder of this root folder

string $file

The file name

string $data

The contents of the new file

Returns

\FAA\Obj\Result|null

Duplicate()

Duplicate(array  $payload): \FAA\Obj\Result

Copy the element Copy the template with additional information

Parameters

array $payload

New element definitions

Returns

\FAA\Obj\Result —

A system result object

Update()

Update(  $payload)

Parameters

$payload

Delete()

Delete(  $skip = false)

Parameters

$skip

prepareDetailPath()

prepareDetailPath(  $name,  $ext,  $depth)

Parameters

$name
$ext
$depth

prepareIndex()

prepareIndex(  $name,  $ext,  $depth)

Parameters

$name
$ext
$depth

resolveParentStatics()

resolveParentStatics(string  $parent_source): string

Resolve static includes

Even if this methods was intentionally designed for parent includes it resolves all template statics. It adds relative and absolute include paths for certain includes like css files and images.

On top it enables the support of smarty like include syntax {include file=""} but only for one level depth.

Parameters

string $parent_source

The absolute path to template file

Returns

string —

The resolved template data as string

pathToCacheFile()

pathToCacheFile(  $name,  $ext)

Parameters

$name
$ext