Bir Onox eklentisinin dosya yapısı:
extensions/plugins/my-plugin/ ├── plugin.json # Meta bilgiler (zorunlu) ├── src/ │ └── MyPlugin.php # Ana sınıf (zorunlu) ├── assets/ │ ├── css/ │ └── js/ ├── views/ │ ├── admin/ # Admin panel görünümleri │ └── storefront/ # Mağaza görünümleri ├── migrations/ │ └── 001_init.sql # Veritabanı tabloları └── config.json # Varsayılan ayarlar
Ana Sınıf
<?php
class MyPlugin extends AbstractPlugin {
public function boot(): void {
// Hook'ları kaydet
$this->hook('storefront.header.after', [$this, 'renderBanner']);
}
public function renderBanner(): string {
return $this->view('storefront/banner');
}
}