abstract class AbstractTemplateView extends AbstractTemplateView implements ViewInterface (View source)

The abstract base of all Fluid views.

Traits

Properties

protected array $supportedOptions

This contains the supported options, their default values, descriptions and types.

protected array $options

The configuration options of this view

protected ControllerContext $controllerContext

Methods

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

assign(string $key, mixed $value)

Add a variable to the view data collection.

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(array $options = null)

Set default options based on the supportedOptions provided

void
setTemplatePathAndFilename(string $templatePathAndFilename)

No description

void
setControllerContext(ControllerContext $controllerContext)

No description

string
renderSection(string $sectionName, array $variables = [], bool $ignoreUnknown = false)

Renders a given section.

void
validateOptions(array $options)

Validate options given to this view.

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

Details

StreamInterface createStream(string $content = '')

No description

Parameters

string $content

Return Value

StreamInterface

StreamInterface createStreamFromFile(string $filename, string $mode = 'r')

No description

Parameters

string $filename
string $mode

Return Value

StreamInterface

StreamInterface createStreamFromResource($resource)

No description

Parameters

$resource

Return Value

StreamInterface

StreamInterface render($actionName = null)

No description

Parameters

$actionName

Return Value

StreamInterface

ViewInterface assign(string $key, mixed $value)

Add a variable to the view data collection.

Can be chained: $this->view->assign(..., ...)->assign(..., ...);

Parameters

string $key

Key of variable

mixed $value

Value of object

Return Value

ViewInterface

for chaining

ViewInterface assignMultiple(array $values)

Add multiple variables to the view data collection

Parameters

array $values

associative array with the key being its name

Return Value

ViewInterface

for chaining

static ViewInterface createWithOptions(array $options)

Factory method to create an instance with given options.

Parameters

array $options

Return Value

ViewInterface

__construct(array $options = null)

Set default options based on the supportedOptions provided

Parameters

array $options

Exceptions

Exception

void setTemplatePathAndFilename(string $templatePathAndFilename)

No description

Parameters

string $templatePathAndFilename

Return Value

void

void setControllerContext(ControllerContext $controllerContext)

No description

Parameters

ControllerContext $controllerContext

Return Value

void

string renderSection(string $sectionName, array $variables = [], bool $ignoreUnknown = false)

Renders a given section.

Parameters

string $sectionName

Name of section to render

array $variables

The variables to use

bool $ignoreUnknown

Ignore an unknown section and just return an empty string

Return Value

string

rendered template for the section

Exceptions

InvalidSectionException

protected void validateOptions(array $options)

Validate options given to this view.

Parameters

array $options

Return Value

void

Exceptions

Exception

protected void setOptions(array $options)

Merges the given options with the default values and sets the resulting options in this object.

Parameters

array $options

Return Value

void

mixed getOption(string $optionName)

Get a specific option of this View

Parameters

string $optionName

Return Value

mixed

Exceptions

Exception

void setOption(string $optionName, mixed $value)

Set a specific option of this View

Parameters

string $optionName
mixed $value

Return Value

void

Exceptions

Exception