- WIP on picea-asset
This commit is contained in:
parent
8a5f5f052b
commit
b6d7e5fad5
|
@ -7,6 +7,7 @@ use Laminas\Diactoros\Response\HtmlResponse;
|
||||||
use Picea\{ Picea, Caching\Cache, Caching\Opcache, Compiler, Compiler\Context, Compiler\BaseContext, FileFetcher, Language\DefaultRegistrations, Method\Request };
|
use Picea\{ Picea, Caching\Cache, Caching\Opcache, Compiler, Compiler\Context, Compiler\BaseContext, FileFetcher, Language\DefaultRegistrations, Method\Request };
|
||||||
use Picea\Extension\{ LanguageHandler, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
use Picea\Extension\{ LanguageHandler, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
||||||
use Picea\Ui\{ Method, Ui };
|
use Picea\Ui\{ Method, Ui };
|
||||||
|
use Picea\Asset\Asset;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Picea::class => function($c) {
|
Picea::class => function($c) {
|
||||||
|
@ -33,6 +34,11 @@ return [
|
||||||
{
|
{
|
||||||
parent::registerAll($compiler);
|
parent::registerAll($compiler);
|
||||||
( new Ui() )->registerFormExtension($compiler);
|
( new Ui() )->registerFormExtension($compiler);
|
||||||
|
|
||||||
|
if ( class_exists('Picea\\Asset\\Asset') ) {
|
||||||
|
( new Asset() )->registerExtension($compiler);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
require_once(__DIR__."/src/Kernel.php");
|
||||||
|
}
|
||||||
|
catch(\Throwable $t) {
|
||||||
|
echo sprintf("%s [ %s ]" , $t->getMessage(), var_export($t->getTrace(), true));
|
||||||
|
}
|
|
@ -51,7 +51,11 @@ trait ControllerTrait {
|
||||||
|
|
||||||
public function renderRawView(string $view, ?array $variables = null) : string
|
public function renderRawView(string $view, ?array $variables = null) : string
|
||||||
{
|
{
|
||||||
return $this->picea->renderHtml($view, $variables ?? [], $this);
|
if ( null === $content = $this->picea->renderHtml($view, $variables ?? [], $this) ) {
|
||||||
|
throw new \RuntimeException("Picea's renderHtml() returned NULL as result ; an error occured within your template `$view`.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderView(string $view, ?array $variables = null) : ResponseInterface
|
public function renderView(string $view, ?array $variables = null) : ResponseInterface
|
||||||
|
|
Loading…
Reference in New Issue