Default view renderer for Hubleto project.
\Hubleto\Framework\Renderer
Parent class | \Hubleto\Framework\Core |
Implements | \Hubleto\Framework\Interfaces\RendererInterface |
Properties
twigLoader
public \Twig\Loader\FilesystemLoader $twigLoader
twig
public \Twig\Environment $twig
Methods
init
public init(): void
getTwig
public getTwig(): \Twig\Environment
addNamespace
Adds namespace for Twig renderer
public addNamespace(string $folder, string $namespace): void
Parameters:
Parameter | Type | Description |
---|---|---|
$folder |
string | |
$namespace |
string |
renderView
public renderView(string $view, array $vars = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$view |
string | |
$vars |
array |
render
Renders the requested content. It can be the (1) whole desktop with complete content; (2) the HTML of a controller requested dynamically using AJAX; or (3) a JSON string requested dynamically using AJAX and further processed in Javascript.
public render(string $route = '', mixed $params = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$route |
string | |
$params |
mixed | Parameters (a.k.a. arguments) of the requested controller. |
Return Value:
Rendered content.
Throws:
When running in CLI and requested controller is blocked for the CLI.
renderSuccess
public renderSuccess(mixed $return): string
Parameters:
Parameter | Type | Description |
---|---|---|
$return |
mixed |
renderWarning
public renderWarning(mixed $message, mixed $isHtml = true): string
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
mixed | |
$isHtml |
mixed |
renderFatal
public renderFatal(mixed $message, mixed $isHtml = true): string
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
mixed | |
$isHtml |
mixed |
renderHtmlFatal
public renderHtmlFatal(mixed $message): string
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
mixed |
renderExceptionHtml
public renderExceptionHtml(mixed $exception, array $args = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$exception |
mixed | |
$args |
array |
renderHtmlWarning
public renderHtmlWarning(mixed $warning): string
Parameters:
Parameter | Type | Description |
---|---|---|
$warning |
mixed |
onBeforeRender
public onBeforeRender(): void
onAfterRender
public onAfterRender(): void
Inherited methods
__construct
public __construct(): mixed
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
logger
Shortcut for the logger service.
public logger(): \Hubleto\Framework\Logger
locale
Shortcut for the locale service.
public locale(): \Hubleto\Framework\Locale
renderer
Shortcut for the renderer service.
public renderer(): \Hubleto\Framework\Renderer
translator
Shortcut for the translator service.
public translator(): \Hubleto\Framework\Interfaces\TranslatorInterface
getModel
[Description for getModel]
public getModel(string $model): \Hubleto\Framework\Models\Model
Parameters:
Parameter | Type | Description |
---|---|---|
$model |
string |
getController
[Description for getController]
public getController(string $controller): \Hubleto\Framework\Controller
Parameters:
Parameter | Type | Description |
---|---|---|
$controller |
string |
translate
Shorthand for core translate() function. Uses own language dictionary.
public translate(string $string, array $vars = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to be translated |
$vars |
array |
Return Value:
Translated string.