Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. class Storefront extends Plugin
  2. {
  3. public static $plugin;
  4. public $schemaVersion = '1.0.1';
  5. public $hasCpSettings = true;
  6. public function init()
  7. {
  8. parent::init();
  9. self::$plugin = $this;
  10.  
  11. $this->setComponents([
  12. 'tracking' => TrackingService::class,
  13. ]);
  14.  
  15. Event::on(
  16. Plugins::class,
  17. Plugins::EVENT_AFTER_INSTALL_PLUGIN,
  18. function (PluginEvent $event) {
  19. if ($event->plugin === $this) {
  20. }
  21. }
  22. );
  23.  
  24. Craft::info(
  25. Craft::t(
  26. 'storefront',
  27. '{name} plugin loaded',
  28. ['name' => $this->name]
  29. ),
  30. __METHOD__
  31. );
  32. }
  33. public function hasCpSection()
  34. {
  35. return false;
  36. }
  37. public function hasSettings()
  38. {
  39. return true;
  40. }
  41. protected function createSettingsModel()
  42. {
  43. return new Settings();
  44. }
  45.  
  46. protected function settingsHtml(): string
  47. {
  48. return Craft::$app->view->renderTemplate('storefront/settings',
  49. [
  50. 'settings' => $this->getSettings()
  51. ]
  52. );
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement