BaseController
in package
This is a true base controller.
It does nothing but base things.
Table of Contents
Constants
- ALLOW_PRODUCTION : mixed = TRUE
Methods
- __call() : void
- Handles methods that do not exist.
- __construct() : void
- _run() : mixed
- The router/kohana will invoke this method to invoke an action.
- getAbsModulePath() : string
- Get the absolute path of the current module for this controller.
- getCssClassName() : string
- Return the class name for this controller, expressed in CSS style, i.e. with dashes
- getModule() : ModuleInterface|null
- Get the module that this controller belongs to.
- getModulePath() : string
- Get the a prefix suitable for finding views for this controller.
Constants
ALLOW_PRODUCTION
public
mixed
ALLOW_PRODUCTION
= TRUE
Methods
__call()
Handles methods that do not exist.
public
__call(string $method, array<string|int, mixed> $args) : void
Parameters
- $method : string
-
Method name
- $args : array<string|int, mixed>
-
Arguments
Tags
__construct()
public
__construct() : void
_run()
The router/kohana will invoke this method to invoke an action.
public
_run(mixed $method, mixed $args) : mixed
If you please, you may wrap this method to create before/after hooks.
Parameters
- $method : mixed
- $args : mixed
getAbsModulePath()
Get the absolute path of the current module for this controller.
public
getAbsModulePath() : string
TODO this might be too broad. It's only used for loading JSON forms and perhaps encourages bad behaviour. Such as assuming common path structures for all modules, where instead this should be written into the module class.
Return values
stringgetCssClassName()
Return the class name for this controller, expressed in CSS style, i.e. with dashes
public
getCssClassName() : string
Example: When called from BlogPostController --> 'blog-post-controller'
Return values
string —Name of this PHP class, in a format suitable for use in CSS
getModule()
Get the module that this controller belongs to.
public
getModule() : ModuleInterface|null
If the controllers belongs to Sprout itself, this returns null.
Return values
ModuleInterface|nullgetModulePath()
Get the a prefix suitable for finding views for this controller.
public
getModulePath() : string
Do not assume that all modules, or even core sprout live relative to each other or the DOCROOT (as they previously did).
TODO rename this - like getViewPrefix()
Return values
string —'sprout' or 'modules/AwesomeModule'