diff --git a/assets/vendor/adrema-form b/assets/vendor/adrema-form index e4fa326..4edc8ee 160000 --- a/assets/vendor/adrema-form +++ b/assets/vendor/adrema-form @@ -1 +1 @@ -Subproject commit e4fa326f3593fc61573bd81bfdfe75a3d4711124 +Subproject commit 4edc8ee3d25b2cd64f2eeb14574f37d6c3920efe diff --git a/components/EventManager.php b/components/EventManager.php index 5fd5d82..89dda63 100644 --- a/components/EventManager.php +++ b/components/EventManager.php @@ -5,6 +5,7 @@ namespace Silva\Adrema\Components; use Illuminate\Support\Collection; use Cms\Classes\ComponentBase; use Cms\Classes\Page; +use Exception; use Silva\Adrema\Exceptions\ComponentException; use Silva\Adrema\Models\Settings; use Silva\Adrema\Support\FetchAllEvents; @@ -174,9 +175,15 @@ abstract class EventManager extends ComponentBase private function addAssets(): void { - $this->addJs('assets/vendor/adrema-form/dist/main.js'); + $manifestFile = $this->getLocalPath('plugins/silva/adrema/assets/vendor/adrema-form/dist/manifest.json'); + + throw_unless(file_exists($manifestFile), Exception::class, 'Manifest for adrema-form not found.'); + + $manifest = json_decode(file_get_contents($manifestFile), true); + + $this->addJs('assets/vendor/adrema-form/dist/'.$manifest['src/main.js']['file']); // $this->addJs('http://localhost:5174/src/main.js', ['type' => 'module']); - $this->addCss('assets/vendor/adrema-form/dist/style.css'); + $this->addCss('assets/vendor/adrema-form/dist/'.$manifest['src/main.js']['css'][0]); } private function loadSettings(): void