Documentation

AbstractController extends CoreObject
in package
implements Controller

AbstractYes

An abstract implementation of the Controller interface, intended to be extended by App controllers

Tags
author

Jason Savell jsavell@library.tamu.edu

Table of Contents

Interfaces

Controller
An interface defining a Controller

Properties

$controllerConfig  : array<string|int, mixed>
$page  : SitePage
$requireAdmin  : bool
$site  : Site
$viewName  : string

Methods

__construct()  : void
evaluate()  : void
This evaluate() implementation looks for $action and $subaction vars from the request input and uses them to build a method name. If that method name exists, it will be invoked. If not, loadDefault() will be called. Any ViewRenderer updates made as a result are then registered with the Site's ViewRenderer.
getAppConfiguration()  : array<string|int, mixed>
Provides a single instance of the global app configuration to all extenders of CoreObject
getLogger()  : Logger
Provides a single instance of a configured Logger to all extenders of CoreObject
configure()  : mixed
Override to handle any Controller specific configurations, e.g. Page details, DataRepository fetching.
getControllerConfig()  : array<string|int, mixed>
Returns the assigned $controllerConfig
getPage()  : SitePage
Returns the assigned SitePage
getSite()  : Site
Gets the Site context for Controllers
getViewName()  : string
Returns the assigned viewName
loadDefault()  : mixed
This is a extending Controller's default endpoint method, executed by ::evaluate(), when no other endpoint methods match the request
setControllerConfig()  : void
Set the $controllerConfig property, which can be used to provide configuration directives to extending Controllers
setPage()  : void
Assigns a SitePage to the controller
setSite()  : mixed
Sets the Site context for Controllers
setViewName()  : void
Controller endpoint methods should use this to set the name of the view for their Controller

Properties

$controllerConfig

protected array<string|int, mixed> $controllerConfig = array()

Optional Configuration directives for a Controller

$requireAdmin

protected bool $requireAdmin = false

A flag identifying a Controller for admin access only

$viewName

protected string $viewName

An identifier for the view an endpoint method wants the ViewRenderer to load

Methods

__construct()

public __construct(Site &$site[, array<string|int, mixed> $controllerConfig = null ]) : void
Parameters
$site : Site
  • the context for the page load
$controllerConfig : array<string|int, mixed> = null
  • An (optional) associative array of Controller specific configuration directives

evaluate()

This evaluate() implementation looks for $action and $subaction vars from the request input and uses them to build a method name. If that method name exists, it will be invoked. If not, loadDefault() will be called. Any ViewRenderer updates made as a result are then registered with the Site's ViewRenderer.

public evaluate() : void

getAppConfiguration()

Provides a single instance of the global app configuration to all extenders of CoreObject

public getAppConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLogger()

Provides a single instance of a configured Logger to all extenders of CoreObject

public getLogger() : Logger
Return values
Logger

configure()

Override to handle any Controller specific configurations, e.g. Page details, DataRepository fetching.

protected configure() : mixed

@return void

getControllerConfig()

Returns the assigned $controllerConfig

protected getControllerConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

$controllerConfig

getSite()

Gets the Site context for Controllers

protected getSite() : Site
Return values
Site

The active Site implementation

getViewName()

Returns the assigned viewName

protected getViewName() : string
Return values
string

$viewName

loadDefault()

This is a extending Controller's default endpoint method, executed by ::evaluate(), when no other endpoint methods match the request

protected abstract loadDefault() : mixed

@return void

setControllerConfig()

Set the $controllerConfig property, which can be used to provide configuration directives to extending Controllers

protected setControllerConfig(array<string|int, mixed> $controllerConfig) : void
Parameters
$controllerConfig : array<string|int, mixed>

setSite()

Sets the Site context for Controllers

protected setSite(Site $site) : mixed
Parameters
$site : Site

The active Site implementation @return void

setViewName()

Controller endpoint methods should use this to set the name of the view for their Controller

protected setViewName(string $viewName) : void
Parameters
$viewName : string
Tags
see
AbstractController::evaluate()

How the $viewName property is used to feed the Interfaces\ViewRenderer


        
On this page

Search results