From 9be929ba877a40c8c34682a33671dbb47515f615 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 3 Feb 2024 22:58:25 +0100 Subject: [PATCH] Lint --- components/EventIndex.php | 14 -------------- components/EventManager.php | 17 +++++++++++++++++ components/EventRegister.php | 14 -------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/components/EventIndex.php b/components/EventIndex.php index 3f03c51..02ae3e9 100644 --- a/components/EventIndex.php +++ b/components/EventIndex.php @@ -4,18 +4,4 @@ namespace Silva\Adrema\Components; class EventIndex extends EventManager { - public function componentDetails() - { - return [ - 'name' => __('event_index_component_name'), - 'description' => __('event_index_component_description'), - ]; - } - - public function onRun() - { - $this->addAssets(); - $this->loadSettings(); - $this->loadSingleEvent(); - } } diff --git a/components/EventManager.php b/components/EventManager.php index 6d15388..6e3dc82 100644 --- a/components/EventManager.php +++ b/components/EventManager.php @@ -15,6 +15,23 @@ abstract class EventManager extends ComponentBase public ?array $event; public string $currentUrl; + public function componentDetails() + { + $componentName = str(class_basename(static::class))->snake(); + + return [ + 'name' => __("{$componentName}_component_name"), + 'description' => __("{$componentName}_component_description"), + ]; + } + + public function onRun() + { + $this->addAssets(); + $this->loadSettings(); + $this->loadSingleEvent(); + } + protected function addAssets(): void { // $this->addJs('assets/vendor/adrema-form/dist/main.js'); diff --git a/components/EventRegister.php b/components/EventRegister.php index de04f76..5b5b5da 100644 --- a/components/EventRegister.php +++ b/components/EventRegister.php @@ -4,18 +4,4 @@ namespace Silva\Adrema\Components; class EventRegister extends EventManager { - public function componentDetails() - { - return [ - 'name' => __('event_register_component_name'), - 'description' => __('event_register_component_description'), - ]; - } - - public function onRun() - { - $this->addAssets(); - $this->loadSettings(); - $this->loadSingleEvent(); - } }