class View implements ViewInterface

View class

Traits

Access options for view components
Theme global vars

Constants

COMPONENT_ERROR_NAME

ACCESS_DENIED_ERROR_CODE

NOT_VALID_COMPONENT_ERROR_CODE

Properties

protected string $primaryTemplate Primary template
protected string|null $templateTheme Template theme
protected array $services Services

Methods

bool
checkAccessOption($component)

Check component access option

from Access
bool
checkAuthOption(array $accessOptions)

Check auth and permissions access

from Access
bool
checkPermissionOption(array $accessOptions)

Check auth and permissions access

from Access
string
getTemplateThemeFile(string $themeName)

Gte template theme file name

bool
includeThemeGlobals(string|null $themeName = null)

Include theme global vars

__construct(CacheInterface $cache, array $services = [], string $viewPath, string $extensionsPath, string $templatesPath, string $componentsPath, array $settings = [], string|null $primaryTemplate = null, string|null $templateTheme = null)

Constructor

mixed|null
getService(string $name)

Get service

mixed
createComponent(string $name, string $language, string $type)

Create component

renderComponent(string $name, array|null $params = [], string $language, string|null $type = null)

Render html component

ComponentInterface
renderComponentError(string $name, string $language, string $errorCode, array $options = [])

Render compoent error

object|null
getFunction(string|null $name = null)

Get extension funciton

string
getPrimaryTemplate()

Get primary template

void
setPrimaryTemplate(string $templateName)

Set primary template

array
getGlobals()

Get all global vars

void
addGlobal(string $name, mixed $value)

Add global variable

string
getComponentsPath()

Get components path

string
getTemplatesPath()

Get templates path

string
getExtensionsPath()

Gte extensions path

string
getViewPath()

Get view path

CacheInterface
getCache()

Get cache

void
addExtension(ExtensionInterface $extension)

Add template extension

string|null
fetch(string $template, array $params = [])

Render template

string|null
fetchBlock(string $template, string $block, array $params = [])

Render template block

string
fetchFromString(string $string, array $params = [])

Render template from string

ExtensionInterface
getExtension(string $class)

Get twig extension

ExtensionInterface
getCurrentExtension()

Get current extension (last added)

FilesystemLoader
getLoader()

Get Twig loader

Environment
getEnvironment()

Get Twig environment

Environment
createEnvironment(array|null $paths = null, array|null $settings = null)

Create twig environment

void
resolveEnvironment()

Create env instance

Details

in Access at line 23
protected bool checkAccessOption($component)

Check component access option

Parameters

$component

Return Value

bool

in Access at line 48
bool checkAuthOption(array $accessOptions)

Check auth and permissions access

Parameters

array $accessOptions

Return Value

bool

in Access at line 70
bool checkPermissionOption(array $accessOptions)

Check auth and permissions access

Parameters

array $accessOptions

Return Value

bool

in ThemeGlobals at line 23
string getTemplateThemeFile(string $themeName)

Gte template theme file name

Parameters

string $themeName

Return Value

string

in ThemeGlobals at line 34
protected bool includeThemeGlobals(string|null $themeName = null)

Include theme global vars

Parameters

string|null $themeName

Return Value

bool

at line 134
__construct(CacheInterface $cache, array $services = [], string $viewPath, string $extensionsPath, string $templatesPath, string $componentsPath, array $settings = [], string|null $primaryTemplate = null, string|null $templateTheme = null)

Constructor

Parameters

CacheInterface $cache
array $services
string $viewPath
string $extensionsPath
string $templatesPath
string $componentsPath
array $settings
string|null $primaryTemplate
string|null $templateTheme

at line 162
mixed|null getService(string $name)

Get service

Parameters

string $name

Return Value

mixed|null

at line 175
mixed createComponent(string $name, string $language, string $type)

Create component

Parameters

string $name
string $language
string $type

Return Value

mixed

at line 189
HtmlComponentInterface renderComponent(string $name, array|null $params = [], string $language, string|null $type = null)

Render html component

Parameters

string $name
array|null $params
string $language
string|null $type

Return Value

HtmlComponentInterface

at line 232
protected ComponentInterface renderComponentError(string $name, string $language, string $errorCode, array $options = [])

Render compoent error

Parameters

string $name
string $language
string $errorCode
array $options

Return Value

ComponentInterface

at line 252
object|null getFunction(string|null $name = null)

Get extension funciton

Parameters

string|null $name

Return Value

object|null

at line 264
string getPrimaryTemplate()

Get primary template

Return Value

string

at line 275
void setPrimaryTemplate(string $templateName)

Set primary template

Parameters

string $templateName

Return Value

void

at line 285
array getGlobals()

Get all global vars

Return Value

array

at line 297
void addGlobal(string $name, mixed $value)

Add global variable

Parameters

string $name
mixed $value

Return Value

void

at line 307
string getComponentsPath()

Get components path

Return Value

string

at line 317
string getTemplatesPath()

Get templates path

Return Value

string

at line 327
string getExtensionsPath()

Gte extensions path

Return Value

string

at line 337
string getViewPath()

Get view path

Return Value

string

at line 347
CacheInterface getCache()

Get cache

Return Value

CacheInterface

at line 358
void addExtension(ExtensionInterface $extension)

Add template extension

Parameters

ExtensionInterface $extension

Return Value

void

at line 371
string|null fetch(string $template, array $params = [])

Render template

Parameters

string $template
array $params

Return Value

string|null

at line 384
string|null fetchBlock(string $template, string $block, array $params = [])

Render template block

Parameters

string $template
string $block
array $params

Return Value

string|null

at line 396
string fetchFromString(string $string, array $params = [])

Render template from string

Parameters

string $string
array $params

Return Value

string

at line 406
ExtensionInterface getExtension(string $class)

Get twig extension

Parameters

string $class

Return Value

ExtensionInterface

at line 416
ExtensionInterface getCurrentExtension()

Get current extension (last added)

Return Value

ExtensionInterface

at line 426
FilesystemLoader getLoader()

Get Twig loader

Return Value

FilesystemLoader

at line 436
Environment getEnvironment()

Get Twig environment

Return Value

Environment

at line 452
Environment createEnvironment(array|null $paths = null, array|null $settings = null)

Create twig environment

Parameters

array|null $paths
array|null $settings

Return Value

Environment

at line 465
protected void resolveEnvironment()

Create env instance

Return Value

void