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