PHP Class Zend\Mvc\View\Http\InjectTemplateListener

Inheritance: extends Zend\EventManager\AbstractListenerAggregate
Afficher le fichier Open project: zendframework/zend-mvc Class Usage Examples

Protected Properties

Свойство Type Description
$controllerMap array Array of controller namespace -> template mappings
$preferRouteMatchController boolean Flag to force the use of the route match controller param

Méthodes publiques

Méthode Description
attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 ) {@inheritDoc}
injectTemplate ( MvcEvent $e ) : void Inject a template into the view model, if none present
isPreferRouteMatchController ( ) : boolean
mapController ( string $controller ) : string | false Maps controller to template if controller namespace is whitelisted or mapped
setControllerMap ( array $map ) : self Set map of controller namespace -> template pairs
setPreferRouteMatchController ( boolean $preferRouteMatchController ) Sets the flag to instruct the listener to prefer the route match controller param over the class name

Méthodes protégées

Méthode Description
deriveControllerClass ( string $controller ) : string Determine the name of the controller
inflectName ( string $name ) : string Inflect a name to a normalized value

Method Details

attach() public méthode

{@inheritDoc}
public attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 )
$events Zend\EventManager\EventManagerInterface

deriveControllerClass() protected méthode

Strip the namespace, and the suffix "Controller" if present.
protected deriveControllerClass ( string $controller ) : string
$controller string
Résultat string

inflectName() protected méthode

Inlines the logic from zend-filter's Word\CamelCaseToDash filter.
protected inflectName ( string $name ) : string
$name string
Résultat string

injectTemplate() public méthode

Template is derived from the controller found in the route match, and, optionally, the action, if present.
public injectTemplate ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent
Résultat void

isPreferRouteMatchController() public méthode

mapController() public méthode

Maps controller to template if controller namespace is whitelisted or mapped
public mapController ( string $controller ) : string | false
$controller string controller FQCN
Résultat string | false template name or false if controller was not matched

setControllerMap() public méthode

Set map of controller namespace -> template pairs
public setControllerMap ( array $map ) : self
$map array
Résultat self

setPreferRouteMatchController() public méthode

Sets the flag to instruct the listener to prefer the route match controller param over the class name
public setPreferRouteMatchController ( boolean $preferRouteMatchController )
$preferRouteMatchController boolean

Property Details

$controllerMap protected_oe property

Array of controller namespace -> template mappings
protected array $controllerMap
Résultat array

$preferRouteMatchController protected_oe property

Flag to force the use of the route match controller param
protected bool $preferRouteMatchController
Résultat boolean