- Fixed assets whenever it's not installed
This commit is contained in:
parent
bc6880c166
commit
d8045b5f3c
|
@ -31,12 +31,6 @@ return [
|
||||||
|
|
||||||
Ui::class => autowire(Ui::class),
|
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),
|
Compiler::class => autowire(Compiler::class),
|
||||||
|
|
||||||
Request::class => autowire(Request::class),
|
Request::class => autowire(Request::class),
|
||||||
|
@ -49,7 +43,7 @@ return [
|
||||||
|
|
||||||
LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class),
|
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) {
|
'picea.extensions' => function(\Psr\Container\ContainerInterface $c) {
|
||||||
return array_merge([
|
return array_merge([
|
||||||
|
@ -76,14 +70,4 @@ return [
|
||||||
FileFetcher::class => function($c) {
|
FileFetcher::class => function($c) {
|
||||||
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
|
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),
|
|
||||||
];
|
];
|
13
src/Lean.php
13
src/Lean.php
|
@ -102,6 +102,8 @@ class Lean
|
||||||
{
|
{
|
||||||
$list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications));
|
$list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications));
|
||||||
|
|
||||||
|
$this->verifyPathList($list);
|
||||||
|
|
||||||
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
|
@ -111,11 +113,22 @@ class Lean
|
||||||
{
|
{
|
||||||
$list = array_merge(...array_map(fn($app) => $app->piceaAssets ?? [], $this->applications));
|
$list = array_merge(...array_map(fn($app) => $app->piceaAssets ?? [], $this->applications));
|
||||||
|
|
||||||
|
$this->verifyPathList($list);
|
||||||
|
|
||||||
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
||||||
|
|
||||||
return $list;
|
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
|
public function getI18n(string $reader) : ? array
|
||||||
{
|
{
|
||||||
switch($reader) {
|
switch($reader) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PiceaDefaultRegistration extends DefaultRegistrations {
|
||||||
{
|
{
|
||||||
parent::registerAll($compiler);
|
parent::registerAll($compiler);
|
||||||
|
|
||||||
$this->ui->registerFormExtension($compiler);
|
$this->ui AND $this->ui->registerFormExtension($compiler);
|
||||||
$this->asset->registerExtension($compiler);
|
$this->asset AND $this->asset->registerExtension($compiler);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue