- Fixed assets whenever it's not installed

This commit is contained in:
Dave M. 2023-10-18 18:03:46 +00:00
parent bc6880c166
commit d8045b5f3c
3 changed files with 16 additions and 19 deletions

View File

@ -31,12 +31,6 @@ return [
Ui::class => autowire(Ui::class),
Asset\Asset::class => autowire(Asset\Asset::class),
Asset\Config::class => create(Asset\Config::class)->constructor(
destination: getenv("PUBLIC_PATH") . DIRECTORY_SEPARATOR . "static"
),
Compiler::class => autowire(Compiler::class),
Request::class => autowire(Request::class),
@ -49,7 +43,7 @@ return [
LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class),
LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), get(Asset\Asset::class)),
LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), null),
'picea.extensions' => function(\Psr\Container\ContainerInterface $c) {
return array_merge([
@ -76,14 +70,4 @@ return [
FileFetcher::class => function($c) {
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
},
Asset\FileFetcher::class => function($c) {
return new Asset\FileFetcher($c->get(Lean\Lean::class)->getAssetPaths());
},
Action\Install::class => autowire(Action\Install::class)->constructor(get(Action\InstallActionInterface::class), []),
Action\Symlink::class => autowire(Action\Symlink::class),
Action\InstallActionInterface::class => autowire(Action\Symlink::class),
];

View File

@ -102,6 +102,8 @@ class Lean
{
$list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications));
$this->verifyPathList($list);
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
return $list;
@ -111,11 +113,22 @@ class Lean
{
$list = array_merge(...array_map(fn($app) => $app->piceaAssets ?? [], $this->applications));
$this->verifyPathList($list);
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
return $list;
}
protected function verifyPathList(array $list) : void
{
foreach($list as $item) {
if (! isset($item['order']) ) {
throw new \RuntimeException(sprintf("An error occured while verifying a path list (%s)", json_encode($item, \JSON_PRETTY_PRINT)));
}
}
}
public function getI18n(string $reader) : ? array
{
switch($reader) {

View File

@ -22,7 +22,7 @@ class PiceaDefaultRegistration extends DefaultRegistrations {
{
parent::registerAll($compiler);
$this->ui->registerFormExtension($compiler);
$this->asset->registerExtension($compiler);
$this->ui AND $this->ui->registerFormExtension($compiler);
$this->asset AND $this->asset->registerExtension($compiler);
}
}