StandaloneView
class StandaloneView extends AbstractTemplateView (View source)
A standalone template view.
Helpful if you want to use Fluid separately from MVC E.g. to generate template based emails.
Traits
Properties
protected array | $supportedOptions | This contains the supported options, their default values, descriptions and types. |
from AbstractTemplateView |
protected array | $options | The configuration options of this view |
from AbstractTemplateView |
protected ControllerContext | $controllerContext | from AbstractTemplateView | |
protected string | $templateSource | Source code of the Fluid template |
|
protected string | $templatePathAndFilename | absolute path of the Fluid template |
|
protected Environment | $environment | ||
protected ActionRequest | $request | ||
protected Bootstrap | $bootstrap |
Methods
No description
Add a variable to the view data collection.
Add multiple variables to the view data collection
Factory method to create an instance with given options.
Sets the absolute path to a Fluid template file
Renders a given section.
Merges the given options with the default values and sets the resulting options in this object.
Set a specific option of this View
Initiates the StandaloneView by creating the required ControllerContext
No description
Sets the format of the current request (default format is "html")
Returns the format of the current request (defaults is "html")
Returns the current request object
Returns the absolute path to a Fluid template file if it was specified with setTemplatePathAndFilename() before
Sets the Fluid template source You can use setTemplatePathAndFilename() alternatively if you only want to specify the template path
Set the root path(s) to the templates.
Set the root path(s) to the layouts.
Resolves the layout root to be used inside other paths.
Sets the absolute path to the folder that contains Fluid layout files
Set the root path(s) to the partials.
Returns the absolute path to the folder that contains Fluid partial files
Sets the absolute path to the folder that contains Fluid partial files.
Checks whether a template can be resolved for the current request
Details
StreamInterface
createStream(string $content = '')
No description
StreamInterface
createStreamFromFile(string $filename, string $mode = 'r')
No description
StreamInterface
createStreamFromResource($resource)
No description
StreamInterface
render($actionName = null)
No description
ViewInterface
assign(string $key, mixed $value)
Add a variable to the view data collection.
Can be chained: $this->view->assign(..., ...)->assign(..., ...);
ViewInterface
assignMultiple(array $values)
Add multiple variables to the view data collection
static ViewInterface
createWithOptions(array $options)
Factory method to create an instance with given options.
__construct(ActionRequest $request = null, array $options = [])
Constructor
void
setTemplatePathAndFilename(string $templatePathAndFilename)
Sets the absolute path to a Fluid template file
void
setControllerContext(ControllerContext $controllerContext)
No description
string
renderSection(string $sectionName, array $variables = [], bool $ignoreUnknown = false)
Renders a given section.
protected void
validateOptions(array $options)
Validate options given to this view.
protected void
setOptions(array $options)
Merges the given options with the default values and sets the resulting options in this object.
mixed
getOption(string $optionName)
Get a specific option of this View
void
setOption(string $optionName, mixed $value)
Set a specific option of this View
void
initializeObject()
Initiates the StandaloneView by creating the required ControllerContext
setTemplate(string $templateName)
No description
void
setFormat(string $format)
Sets the format of the current request (default format is "html")
string
getFormat()
Returns the format of the current request (defaults is "html")
ActionRequest
getRequest()
Returns the current request object
string
getTemplatePathAndFilename()
Returns the absolute path to a Fluid template file if it was specified with setTemplatePathAndFilename() before
void
setTemplateSource(string $templateSource)
Sets the Fluid template source You can use setTemplatePathAndFilename() alternatively if you only want to specify the template path
void
setTemplateRootPaths(array $templateRootPaths)
Set the root path(s) to the templates.
void
setLayoutRootPaths(array $layoutRootPaths)
Set the root path(s) to the layouts.
array
getLayoutRootPaths()
Resolves the layout root to be used inside other paths.
void
setLayoutRootPath(string $layoutRootPath)
Sets the absolute path to the folder that contains Fluid layout files
void
setPartialRootPaths(array $partialRootPaths)
Set the root path(s) to the partials.
If set, overrides the one determined from $this->partialRootPathPattern
array
getPartialRootPaths()
Returns the absolute path to the folder that contains Fluid partial files
void
setPartialRootPath(string $partialRootPath)
Sets the absolute path to the folder that contains Fluid partial files.
bool
hasTemplate()
Checks whether a template can be resolved for the current request