Default implementation of Hubleto controller.
'Controller' is fundamendal class for generating HTML content of each call. Controllers can be rendered using Twig template or using custom render() method.
\Hubleto\Framework\Controller
| Parent class | \Hubleto\Framework\Core |
| Implements | \Hubleto\Framework\Interfaces\ControllerInterface |
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
RETURN_TYPE_VIEW |
public | 0 | |
RETURN_TYPE_JSON |
public | 1 | |
RETURN_TYPE_STRING |
public | 2 | |
RETURN_TYPE_NONE |
public | 3 |
Properties
Shorthand for "global table prefix"
DEPRECATED Array of parameters (arguments) passed to the controller
TRUE/FALSE array with permissions for the user role
- This property is static.
If set to FALSE, the rendered content of controller is available to public
If set to TRUE, the controller's permissions is not checked.
If set to TRUE, the default desktop will not be added to the rendered content
If set to FALSE, the controller will not be rendered in CLI
- This property is static.
If set to FALSE, the controller will not be rendered in WEB
- This property is static.
Methods
ƒ __construct
public __construct(): mixed
ƒ validateInputs
Validates inputs used for the TWIG template.
public validateInputs(): bool
return bool True if inputs are valid, otherwise false.
ƒ preInit
1st phase of controller's initialization phase.
public preInit(): void
Throws
Should throw an exception on error.
ƒ init
2nd phase of controller's initialization phase.
public init(): void
Throws
Should throw an exception on error.
ƒ postInit
3rd phase of controller's initialization phase.
public postInit(): void
Throws
Should throw an exception on error.
ƒ run
public run(): mixed
ƒ renderString
public renderString(): string
ƒ renderJson
If the controller shall only return JSON, this method must be overriden.
public renderJson(): array
Return Value
Array to be returned as a JSON.
ƒ prepareViewParams
If the controller shall return the HTML of the view, this method must be overriden.
public prepareViewParams(): array
Return Value
View to be used to render the HTML.
ƒ prepareView
[Description for prepareView]
public prepareView(): void
ƒ setView
[Description for setView]
public setView(string $view): void
Parameters
| Parameter | Type | Description |
|---|---|---|
$view |
string |
ƒ getView
[Description for getView]
public getView(): string
ƒ getViewParams
[Description for getViewParams]
public getViewParams(): array
ƒ render
[Description for render]
public render(): string
Inherited methods
ƒ __construct
public __construct(): mixed
ƒ setDebugLevel
[Description for setDebugLevel]
public setDebugLevel(int $level): void
Parameters
| Parameter | Type | Description |
|---|---|---|
$level |
int |
ƒ getDebugLevel
[Description for getDebugLevel]
public getDebugLevel(): int
ƒ getServiceStatic
Shortcut for the dependency injection.
public static getServiceStatic(string $service): mixed
- This method is static.
Parameters
| Parameter | Type | Description |
|---|---|---|
$service |
string |
ƒ getService
[Description for getService]
public getService(string $service): mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$service |
string |
ƒ env
Shortcut for the env service.
public env(): \Hubleto\Framework\Env
ƒ authProvider
Shortcut for the authentication service.
public authProvider(): \Hubleto\Framework\Interfaces\AuthInterface
ƒ db
Shortcut for the database service.
public db(): \Hubleto\Framework\Db
ƒ appManager
Shortcut for the app manager service.
public appManager(): \Hubleto\Framework\Interfaces\AppManagerInterface
ƒ router
Shortcut for the router service.
public router(): \Hubleto\Framework\Router
ƒ hookManager
Shortcut for the hook manager service.
public hookManager(): \Hubleto\Framework\HookManager
ƒ sessionManager
Shortcut for the session manager service.
public sessionManager(): \Hubleto\Framework\SessionManager
ƒ permissionsManager
Shortcut for the permissions manager service.
public permissionsManager(): \Hubleto\Framework\PermissionsManager
ƒ cronManager
Shortcut for the cron manager service.
public cronManager(): \Hubleto\Framework\CronManager
ƒ emailProvider
Shortcut for the email provider service.
public emailProvider(): \Hubleto\Framework\EmailProvider
ƒ config
Shortcut for the config service.
public config(): \Hubleto\Framework\Interfaces\ConfigManagerInterface
ƒ terminal
Shortcut for the terminal service.
public terminal(): \Hubleto\Framework\Interfaces\TerminalInterface
ƒ logger
Shortcut for the logger service.
public logger(): \Hubleto\Framework\Interfaces\LoggerInterface
ƒ locale
Shortcut for the locale service.
public locale(): \Hubleto\Framework\Interfaces\LocaleInterface
ƒ renderer
Shortcut for the renderer service.
public renderer(): \Hubleto\Framework\Interfaces\RendererInterface
ƒ translator
Shortcut for the translator service.
public translator(): \Hubleto\Framework\Interfaces\TranslatorInterface
ƒ getModel
[Description for getModel]
public getModel(string $model): \Hubleto\Framework\Interfaces\ModelInterface
Parameters
| Parameter | Type | Description |
|---|---|---|
$model |
string |
ƒ getController
[Description for getController]
public getController(string $controller): \Hubleto\Framework\Controller
Parameters
| Parameter | Type | Description |
|---|---|---|
$controller |
string |
ƒ translate
public translate(string $string, array<string,string> $vars = [], string $contextInner = ''): string
Parameters
| Parameter | Type | Description |
|---|---|---|
$string |
string | |
$vars |
array<string,string> | |
$contextInner |
string |
