Arikaim CMS

TwigExtension extends AbstractExtension
in package
implements GlobalsInterface

Template engine functions, filters and tests.

Table of Contents

Interfaces

GlobalsInterface

Properties

$markdownParser  : object
Markdown parser
$protectedModels  : array<string|int, mixed>
Model classes requires control panel access
$protectedServices  : array<string|int, mixed>
Protected services requires control panel access
$userProtectedServices  : array<string|int, mixed>
Protected services requires logged user

Methods

addPageHeadCode()  : void
Add page head code
createModel()  : Model|null
Create model
extractArray()  : void
Exctract array as local variables in template
fetch()  : Response|null
Fetch url
getAccess()  : mixed
Get access
getCache()  : CacheInterface
Get cache
getCurrentLanguage()  : string
Return current language
getCurrentUrl()  : string
Return current url
getDirectoryFiles()  : array<string|int, mixed>|false
Get directory contents
getFileType()  : string|null
Return file type
getFilters()  : array<string|int, mixed>
Template engine filters
getFunctions()  : array<string|int, mixed>
Template engine functions
getGlobals()  : array<string|int, mixed>
Rempate engine global variables
getLanguage()  : string
Get current page language
getLanguages()  : array<string|int, mixed>
Get theme languages
getOption()  : mixed
Get option
getOptions()  : array<string|int, mixed>
Get options
getPageUrl()  : string|false
Get page url
getPaginatorUrl()  : string
Get paginator url
getRelationsMap()  : array<string|int, mixed>|null
Get relatins type map (morph map)
getService()  : mixed
Get service from container
getSessionVar()  : mixed
Get session var
getTests()  : array<string|int, mixed>
Template engine tests
getTokenParsers()  : array<string|int, mixed>
Template engine tags
hasExtension()  : bool
Return true if extension exists
loadComponent()  : string|null
Load component
loadLibraryFile()  : string
Load Ui library file
pageHead()  : object
Get page head
parseMarkdown()  : string
Parse Markdown
readThemeModules()  : array<string|int, mixed>
Read theme modules descriptor files
setSessionVar()  : void
Set session var

Properties

$markdownParser

Markdown parser

protected object $markdownParser

$protectedModels

Model classes requires control panel access

protected array<string|int, mixed> $protectedModels = ['PermissionRelations', 'Permissions', 'Routes', 'Modules', 'Events', 'Drivers', 'Extensions', 'Jobs', 'EventSubscribers']

$protectedServices

Protected services requires control panel access

protected array<string|int, mixed> $protectedServices = ['config', 'packages']

$userProtectedServices

Protected services requires logged user

protected array<string|int, mixed> $userProtectedServices = ['storage']

Methods

addPageHeadCode()

Add page head code

public addPageHeadCode(string $code) : void

@param string $code

Parameters
$code : string

createModel()

Create model

public createModel(string $modelClass[, string|null $extension = null ][, bool $showError = false ]) : Model|null
Parameters
$modelClass : string
$extension : string|null = null
$showError : bool = false
Return values
Model|null

extractArray()

Exctract array as local variables in template

public extractArray(array<string|int, mixed> &$context, array<string|int, mixed> $data) : void
Parameters
$context : array<string|int, mixed>
$data : array<string|int, mixed>

fetch()

Fetch url

public fetch(string $url) : Response|null
Parameters
$url : string
Return values
Response|null

getCache()

Get cache

public getCache() : CacheInterface
Return values
CacheInterface

getCurrentLanguage()

Return current language

public getCurrentLanguage() : string
Return values
string

getCurrentUrl()

Return current url

public getCurrentUrl([bool $full = true ][, string|null $path = null ]) : string
Parameters
$full : bool = true
$path : string|null = null
Return values
string

getDirectoryFiles()

Get directory contents

public getDirectoryFiles(string $path[, bool $recursive = false ][, string|null $fileSystemName = null ]) : array<string|int, mixed>|false
Parameters
$path : string
$recursive : bool = false
$fileSystemName : string|null = null
Return values
array<string|int, mixed>|false

getFileType()

Return file type

public getFileType(string $fileName) : string|null
Parameters
$fileName : string
Return values
string|null

getFilters()

Template engine filters

public getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFunctions()

Template engine functions

public getFunctions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getGlobals()

Rempate engine global variables

public getGlobals() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLanguage()

Get current page language

public getLanguage() : string
Return values
string

getLanguages()

Get theme languages

public getLanguages() : array<string|int, mixed>
Return values
array<string|int, mixed>

getOption()

Get option

public getOption(string $name[, mixed $default = null ]) : mixed
Parameters
$name : string
$default : mixed = null

getOptions()

Get options

public getOptions(string $searchKey[, bool $compactKeys = false ]) : array<string|int, mixed>
Parameters
$searchKey : string
$compactKeys : bool = false
Return values
array<string|int, mixed>

getPageUrl()

Get page url

public getPageUrl(string $routeName, string|null $extension[, array<string|int, mixed> $params = [] ][, bool $relative = false ][, string|null $language = null ]) : string|false
Parameters
$routeName : string
$extension : string|null
$params : array<string|int, mixed> = []
$relative : bool = false
$language : string|null = null
Return values
string|false

getPaginatorUrl()

Get paginator url

public getPaginatorUrl(string $pageUrl, int $page[, bool $full = true ][, bool $withLanguagePath = false ]) : string
Parameters
$pageUrl : string
$page : int
$full : bool = true
$withLanguagePath : bool = false
Return values
string

getRelationsMap()

Get relatins type map (morph map)

public getRelationsMap() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getService()

Get service from container

public getService(string $name) : mixed
Parameters
$name : string

getSessionVar()

Get session var

public getSessionVar(string $name[, mixed $default = null ]) : mixed
Parameters
$name : string
$default : mixed = null

getTests()

Template engine tests

public getTests() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTokenParsers()

Template engine tags

public getTokenParsers() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasExtension()

Return true if extension exists

public hasExtension(string|array<string|int, mixed> $extension) : bool
Parameters
$extension : string|array<string|int, mixed>
Return values
bool

loadComponent()

Load component

public loadComponent(array<string|int, mixed> $context, string $name[, array<string|int, mixed>|null $params = [] ][, string|null $type = null ]) : string|null
Parameters
$context : array<string|int, mixed>
$name : string
$params : array<string|int, mixed>|null = []
$type : string|null = null
Return values
string|null

loadLibraryFile()

Load Ui library file

public loadLibraryFile(string $library, string $fileName) : string
Parameters
$library : string
$fileName : string
Return values
string

pageHead()

Get page head

public pageHead() : object

@return object

Return values
object

parseMarkdown()

Parse Markdown

public parseMarkdown(string $content[, array<string|int, mixed> $context = [] ]) : string
Parameters
$content : string
$context : array<string|int, mixed> = []
Return values
string

readThemeModules()

Read theme modules descriptor files

public readThemeModules(string $templatePath[, array<string|int, mixed>|null $modules = null ]) : array<string|int, mixed>
Parameters
$templatePath : string
$modules : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

setSessionVar()

Set session var

public setSessionVar(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

        
On this page

Search results