Total Complexity | 4 |
Total Lines | 75 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | class Lever extends \craft\base\Plugin |
||
30 | { |
||
31 | /** |
||
32 | * @var Lever |
||
33 | */ |
||
34 | public static $plugin; |
||
35 | |||
36 | /** |
||
37 | * @var bool |
||
38 | */ |
||
39 | public $hasCpSettings = true; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | public $t9nCategory = 'lever'; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | public $schemaVersion = '1.0.0'; |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public function init() |
||
55 | { |
||
56 | parent::init(); |
||
57 | self::$plugin = $this; |
||
58 | |||
59 | $this->setComponents([ |
||
60 | 'api' => LeverService::class, |
||
61 | ]); |
||
62 | |||
63 | Event::on( |
||
64 | CraftVariable::class, |
||
65 | CraftVariable::EVENT_INIT, |
||
66 | function (Event $event) { |
||
67 | $variable = $event->sender; |
||
68 | $variable->set('lever', LeverVariable::class); |
||
69 | } |
||
70 | ); |
||
71 | |||
72 | Craft::info( |
||
73 | Craft::t( |
||
74 | 'lever', |
||
75 | '{name} plugin loaded', |
||
76 | ['name' => $this->name] |
||
77 | ), |
||
78 | __METHOD__ |
||
79 | ); |
||
80 | } |
||
81 | |||
82 | public function defineTemplateComponent() |
||
83 | { |
||
84 | return LeverVariable::class; |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @inheritdoc |
||
89 | */ |
||
90 | protected function createSettingsModel() |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @inheritdoc |
||
97 | */ |
||
98 | protected function settingsHtml(): string |
||
109 |