Skip to content

ViewInitContext

ViewInitContext: minimal, presentation-focused initialization contract for views.

Decouples views from action/request execution mechanics and legacy container.

interface ViewInitContext

Implemented byImmutableViewInitContext
SourceExecution/ViewInitContext.php
MethodDescription
getActionAttributes(): array<string, mixed>
getActionModuleName(): ?stringReturns the module of the action that selected this view.
getActionName(): ?stringReturns the name of the action that selected this view, or null when there was none.
getContext(): ContextReturns the application Context the view is rendering under.
getModuleName(): stringReturns the module name for legacy code written against the action-container convention (getModuleName()), which predates the view/action module split.
getOutputTypeName(): stringReturns the lowercase name of the output type the view renders for.
[`getPsrResponse(): ResponseInterfacenull`](#getpsrresponse)
getResponse(): WebResponseReturns the response the view writes its rendered output into.
getValidationManager(): ?ValidationManagerReturns the validation manager carrying this dispatch’s error state, or null when none is available.
getViewModuleName(): stringReturns the canonical name of the module hosting the view.
getViewName(): stringReturns the canonical name of the view being rendered.

abstract public function getActionAttributes(): array<string, mixed>

Returns array``<``string``, ``mixed``>

abstract public function getActionModuleName(): ?string

Returns the module of the action that selected this view.

Null when the view was reached without an originating action, so callers that need a module name should fall back to the view module.

Returns ?``string

abstract public function getActionName(): ?string

Returns the name of the action that selected this view, or null when there was none.

Returns ?``string

abstract public function getContext(): Context

Returns the application Context the view is rendering under.

Returns Context

abstract public function getModuleName(): string

Returns the module name for legacy code written against the action-container convention (getModuleName()), which predates the view/action module split.

Implementations fall back to the view module when there is no originating action.

Returns string

abstract public function getOutputTypeName(): string

Returns the lowercase name of the output type the view renders for.

Returns string

abstract public function getPsrResponse(): ResponseInterface|null

Optional PSR-7 response adapter backing the legacy response.

Views may use this when interacting with PSR-aware middleware or code.

Returns ResponseInterface|``null

abstract public function getResponse(): WebResponse

Returns the response the view writes its rendered output into.

Returns WebResponse

abstract public function getValidationManager(): ?ValidationManager

Returns the validation manager carrying this dispatch’s error state, or null when none is available.

Returns ?ValidationManager

abstract public function getViewModuleName(): string

Returns the canonical name of the module hosting the view.

Returns string

abstract public function getViewName(): string

Returns the canonical name of the view being rendered.

Returns string