Context maintains global environment and acts as resource container. More...
Public Member Functions | |
__construct (array $resource_factories_config) | |
Constructor. | |
setDefaultLocale ($locale) | |
Set locale which will be used as fallback when setting new locale. | |
__get ($resource_name) | |
Lazily create requested resource and store it as public property, so this is called only once per resource. More... | |
Protected Member Functions | |
setupTranslator () | |
Setup translator: Bind gettext domain. | |
For blocks | |
setLocale ($locale) | |
Set gettext locale, the global environment will be updated at next updateEnviroment() call. | |
For Cascade controller | |
updateEnviroment () | |
Update enviroment from context, returns true if changes required (for child classes) | |
Context maintains global environment and acts as resource container.
It is created during initialization and then passed to all block storages (IBlockStorage) and to CascadeController. From CascadeController it is accessible to all Block instances in the cascade.
The Context has two jobs to do:
Just before block is executed Context::updateEnviroment() is called.
Resources are created lazily, when they are requested for the first time.
Resources specified in 'resources' option are dereferenced and passed as regular (top-level) options within the rest of factory configuration.
__get | ( | $resource_name | ) |
Lazily create requested resource and store it as public property, so this is called only once per resource.