ViewService
class ViewService (View source)
Provide general view-related functionality.
Methods
Constructor.
Get global variables.
Set a global variable.
Set an array of global variables.
Get view composer.
Composes a view instance with contexts in the following order: Global, Composers, Local.
Check if a view exists.
Return a canonical string representation of the view name.
Create a view instance from the first view name that exists.
Trigger core hooks for a partial, if any.
Render a view.
Details
at line 64
__construct(array $config, ViewEngineInterface $engine, HandlerFactory $handler_factory)
Constructor.
at line 75
array
getGlobals()
Get global variables.
at line 86
void
addGlobal(string $key, mixed $value)
Set a global variable.
at line 96
void
addGlobals(array $globals)
Set an array of global variables.
at line 148
void
compose(ViewInterface $view)
Composes a view instance with contexts in the following order: Global, Composers, Local.
at line 168
boolean
exists(string $view)
Check if a view exists.
at line 178
string
canonical(string $view)
Return a canonical string representation of the view name.
at line 188
ViewInterface
make(string|string[] $views)
Create a view instance from the first view name that exists.
at line 199
void
triggerPartialHooks(string $name)
Trigger core hooks for a partial, if any.
at line 222
void
render(string|string[] $views, array $context = [])
Render a view.