- WIP on picea-asset

This commit is contained in:
Dave M. 2023-10-06 19:09:45 -04:00
parent 8a5f5f052b
commit b6d7e5fad5
3 changed files with 20 additions and 1 deletions

View File

@ -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);
}
} }
}); });

9
skeleton/lean Executable file
View File

@ -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));
}

View File

@ -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