10
10
11
11
namespace nystudio107 \units ;
12
12
13
- use nystudio107 \units \fields \Units as UnitsField ;
14
- use nystudio107 \units \helpers \ClassHelper ;
15
- use nystudio107 \units \models \Settings ;
16
- use nystudio107 \units \variables \UnitsVariable ;
17
-
18
13
use Craft ;
19
14
use craft \base \Plugin ;
20
15
use craft \events \PluginEvent ;
21
16
use craft \events \RegisterComponentTypesEvent ;
17
+
22
18
use craft \services \Fields ;
23
19
use craft \services \Plugins ;
24
20
use craft \web \twig \variables \CraftVariable ;
25
-
26
- use yii \base \Event ;
21
+ use nystudio107 \units \fields \Units as UnitsField ;
22
+ use nystudio107 \units \helpers \ClassHelper ;
23
+ use nystudio107 \units \models \Settings ;
24
+ use nystudio107 \units \variables \UnitsVariable ;
27
25
28
26
use PhpUnitsOfMeasure \PhysicalQuantity \Length ;
29
27
28
+ use yii \base \Event ;
29
+
30
30
/**
31
31
* Class Units
32
32
*
@@ -71,7 +71,7 @@ public function init()
71
71
Event::on (
72
72
Fields::class,
73
73
Fields::EVENT_REGISTER_FIELD_TYPES ,
74
- function (RegisterComponentTypesEvent $ event ) {
74
+ function (RegisterComponentTypesEvent $ event ) {
75
75
$ event ->types [] = UnitsField::class;
76
76
}
77
77
);
@@ -80,7 +80,7 @@ function (RegisterComponentTypesEvent $event) {
80
80
Event::on (
81
81
CraftVariable::class,
82
82
CraftVariable::EVENT_INIT ,
83
- function (Event $ event ) {
83
+ function (Event $ event ) {
84
84
/** @var CraftVariable $variable */
85
85
$ variable = $ event ->sender ;
86
86
$ variable ->set ('units ' , self ::$ variable );
@@ -90,7 +90,7 @@ function (Event $event) {
90
90
Event::on (
91
91
Plugins::class,
92
92
Plugins::EVENT_AFTER_INSTALL_PLUGIN ,
93
- function (PluginEvent $ event ) {
93
+ function (PluginEvent $ event ) {
94
94
if ($ event ->plugin === $ this ) {
95
95
}
96
96
}
@@ -99,11 +99,11 @@ function (PluginEvent $event) {
99
99
Event::on (
100
100
UnitsField::class,
101
101
'craftQlGetFieldSchema ' ,
102
- function ($ event ) {
102
+ function ($ event ) {
103
103
$ field = $ event ->sender ;
104
104
105
105
if (!$ field instanceof UnitsField) {
106
- return ;
106
+ return ;
107
107
}
108
108
109
109
$ object = $ event ->schema ->createObjectType (ucfirst ($ field ->handle ) . 'Units ' );
0 commit comments