View
in package
implements
ViewInterface
Uses
Access, ThemeGlobals
View class
Table of Contents
Interfaces
- ViewInterface
- View interface
Constants
- ACCESS_DENIED_ERROR_CODE = 'ACCESS_DENIED'
- COMPONENT_ERROR_NAME = 'semantic~message.error'
- NOT_VALID_COMPONENT_ERROR_CODE = 'NOT_VALID_COMPONENT'
Properties
- $primaryTemplate : string
- Primary template
- $services : array<string|int, mixed>
- Services
- $templateTheme : string|null
- Template theme
- $cache : CacheInterface
- Cache
- $componentsPath : string
- Components path
- $currentExtensionClass : string|null
- Current extension class
- $environment : Environment|null
- Twig env
- $extensionsPath : string
- Extensions Path
- $loader : FilesystemLoader|null
- Template loader
- $settings : array<string|int, mixed>
- Twig view settigns
- $templatesPath : string
- Templates path
- $viewPath : string
- Vie wpath
Methods
- __construct() : mixed
- Constructor
- addExtension() : void
- Add template extension
- addGlobal() : void
- Add global variable
- checkAuthOption() : bool
- Check auth and permissions access
- checkPermissionOption() : bool
- Check auth and permissions access
- createComponent() : ComponentInterface
- Create component
- createEnvironment() : Environment
- Create twig environment
- destroyEnvironment() : void
- Clear current env
- fetch() : string
- Render template
- fetchBlock() : string|null
- Render template block
- fetchFromString() : string
- Render template from string
- getCache() : CacheInterface
- Get cache
- getComponentsPath() : string
- Get components path
- getCurrentExtension() : ExtensionInterface
- Get current extension (last added)
- getEnvironment() : Environment
- Get Twig environment
- getExtension() : ExtensionInterface
- Get twig extension
- getExtensionsPath() : string
- Gte extensions path
- getFunction() : object|null
- Get extension funciton
- getGlobals() : array<string|int, mixed>
- Get all global vars
- getGlobalVar() : mixed
- Get global variable
- getLoader() : FilesystemLoader
- Get Twig loader
- getPrimaryTemplate() : string
- Get primary template
- getService() : mixed|null
- Get service
- getTemplatesPath() : string
- Get templates path
- getTemplateThemeFile() : string
- Gte template theme file name
- getViewPath() : string
- Get view path
- hasGlobal() : bool
- Return true if global vari exist
- renderComponent() : ComponentInterface
- Render html component
- setPrimaryTemplate() : void
- Set primary template
- checkAccessOption() : bool
- Check component access option
- includeThemeGlobals() : bool
- Include theme global vars
- renderComponentError() : ComponentInterface
- Render compoent error
- resolveEnvironment() : void
- Create env instance
Constants
ACCESS_DENIED_ERROR_CODE
public
mixed
ACCESS_DENIED_ERROR_CODE
= 'ACCESS_DENIED'
COMPONENT_ERROR_NAME
public
mixed
COMPONENT_ERROR_NAME
= 'semantic~message.error'
NOT_VALID_COMPONENT_ERROR_CODE
public
mixed
NOT_VALID_COMPONENT_ERROR_CODE
= 'NOT_VALID_COMPONENT'
Properties
$primaryTemplate
Primary template
protected
string
$primaryTemplate
$services
Services
protected
array<string|int, mixed>
$services
= []
$templateTheme
Template theme
protected
string|null
$templateTheme
$cache
Cache
private
CacheInterface
$cache
$componentsPath
Components path
private
string
$componentsPath
$currentExtensionClass
Current extension class
private
string|null
$currentExtensionClass
= null
$environment
Twig env
private
Environment|null
$environment
= null
$extensionsPath
Extensions Path
private
string
$extensionsPath
$loader
Template loader
private
FilesystemLoader|null
$loader
= null
$settings
Twig view settigns
private
array<string|int, mixed>
$settings
= []
$templatesPath
Templates path
private
string
$templatesPath
$viewPath
Vie wpath
private
string
$viewPath
Methods
__construct()
Constructor
public
__construct(CacheInterface $cache, string $viewPath, string $extensionsPath, string $templatesPath, string $componentsPath[, array<string|int, mixed> $services = [] ][, array<string|int, mixed> $settings = [] ][, string|null $primaryTemplate = null ][, string|null $templateTheme = null ]) : mixed
Parameters
- $cache : CacheInterface
- $viewPath : string
- $extensionsPath : string
- $templatesPath : string
- $componentsPath : string
- $services : array<string|int, mixed> = []
- $settings : array<string|int, mixed> = []
- $primaryTemplate : string|null = null
- $templateTheme : string|null = null
addExtension()
Add template extension
public
addExtension(ExtensionInterface $extension) : void
Parameters
- $extension : ExtensionInterface
addGlobal()
Add global variable
public
addGlobal(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
checkAuthOption()
Check auth and permissions access
public
checkAuthOption(array<string|int, mixed> $accessOptions) : bool
Parameters
- $accessOptions : array<string|int, mixed>
Return values
boolcheckPermissionOption()
Check auth and permissions access
public
checkPermissionOption(array<string|int, mixed> $accessOptions) : bool
Parameters
- $accessOptions : array<string|int, mixed>
Return values
boolcreateComponent()
Create component
public
createComponent(string $name, string $language, string $type[, int|null $renderMode = null ][, array<string|int, mixed> $parent = [] ]) : ComponentInterface
Parameters
- $name : string
- $language : string
- $type : string
- $renderMode : int|null = null
- $parent : array<string|int, mixed> = []
Return values
ComponentInterfacecreateEnvironment()
Create twig environment
public
createEnvironment([array<string|int, mixed>|null $paths = null ][, array<string|int, mixed>|null $settings = null ]) : Environment
Parameters
- $paths : array<string|int, mixed>|null = null
- $settings : array<string|int, mixed>|null = null
Return values
EnvironmentdestroyEnvironment()
Clear current env
public
destroyEnvironment() : void
fetch()
Render template
public
fetch(string $template[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $template : string
- $params : array<string|int, mixed> = []
Return values
stringfetchBlock()
Render template block
public
fetchBlock(string $template, string $block[, array<string|int, mixed> $params = [] ]) : string|null
Parameters
- $template : string
- $block : string
- $params : array<string|int, mixed> = []
Return values
string|nullfetchFromString()
Render template from string
public
fetchFromString(string $string[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $string : string
- $params : array<string|int, mixed> = []
Return values
stringgetCache()
Get cache
public
getCache() : CacheInterface
Return values
CacheInterfacegetComponentsPath()
Get components path
public
getComponentsPath() : string
Return values
stringgetCurrentExtension()
Get current extension (last added)
public
getCurrentExtension() : ExtensionInterface
Return values
ExtensionInterfacegetEnvironment()
Get Twig environment
public
getEnvironment() : Environment
Return values
EnvironmentgetExtension()
Get twig extension
public
getExtension(string $class) : ExtensionInterface
Parameters
- $class : string
Return values
ExtensionInterfacegetExtensionsPath()
Gte extensions path
public
getExtensionsPath() : string
Return values
stringgetFunction()
Get extension funciton
public
getFunction([string|null $name = null ]) : object|null
Parameters
- $name : string|null = null
Return values
object|nullgetGlobals()
Get all global vars
public
getGlobals() : array<string|int, mixed>
Return values
array<string|int, mixed>getGlobalVar()
Get global variable
public
getGlobalVar(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
getLoader()
Get Twig loader
public
getLoader() : FilesystemLoader
Return values
FilesystemLoadergetPrimaryTemplate()
Get primary template
public
getPrimaryTemplate() : string
Return values
stringgetService()
Get service
public
getService(string $name) : mixed|null
Parameters
- $name : string
Return values
mixed|nullgetTemplatesPath()
Get templates path
public
getTemplatesPath() : string
Return values
stringgetTemplateThemeFile()
Gte template theme file name
public
getTemplateThemeFile(string $themeName) : string
Parameters
- $themeName : string
Return values
stringgetViewPath()
Get view path
public
getViewPath() : string
Return values
stringhasGlobal()
Return true if global vari exist
public
hasGlobal(string $name) : bool
Parameters
- $name : string
Return values
boolrenderComponent()
Render html component
public
renderComponent(string $name, string $language[, array<string|int, mixed>|null $params = [] ][, string|null $type = null ][, int|null $mode = null ][, array<string|int, mixed> $parent = [] ]) : ComponentInterface
Parameters
- $name : string
- $language : string
- $params : array<string|int, mixed>|null = []
- $type : string|null = null
- $mode : int|null = null
- $parent : array<string|int, mixed> = []
Return values
ComponentInterfacesetPrimaryTemplate()
Set primary template
public
setPrimaryTemplate(string $templateName) : void
Parameters
- $templateName : string
checkAccessOption()
Check component access option
protected
checkAccessOption( $component) : bool
Parameters
Return values
boolincludeThemeGlobals()
Include theme global vars
protected
includeThemeGlobals([string|null $themeName = null ]) : bool
Parameters
- $themeName : string|null = null
Return values
boolrenderComponentError()
Render compoent error
protected
renderComponentError(string $name, string $language, string $errorCode[, array<string|int, mixed> $options = [] ]) : ComponentInterface
Parameters
- $name : string
- $language : string
- $errorCode : string
- $options : array<string|int, mixed> = []
Return values
ComponentInterfaceresolveEnvironment()
Create env instance
protected
resolveEnvironment() : void