55use GraphQL \Type \Definition \ObjectType ;
66use ProcessWire \GraphQL \Cache ;
77use ProcessWire \InputfieldSelectMultiple ;
8+ use ProcessWire \Field ;
9+ use ProcessWire \GraphQL \Utils ;
810use ProcessWire \GraphQL \Type \Fieldtype \Traits \SetValueTrait ;
911use ProcessWire \GraphQL \Type \Fieldtype \Traits \FieldTrait ;
1012
@@ -63,7 +65,7 @@ public static function type($field)
6365
6466 public static function inputType ($ field )
6567 {
66- return Cache::type (self ::$ inputName , function () use ($ field ) {
68+ return Cache::type (self ::getName ( $ field ) , function () use ($ field ) {
6769 $ options = [];
6870 foreach ($ field ->type ->getOptions ($ field ) as $ option ) {
6971 $ options [$ option ->title ? $ option ->title : $ option ->value ] = [
@@ -73,7 +75,7 @@ public static function inputType($field)
7375 }
7476
7577 $ type = new EnumType ([
76- 'name ' => self ::$ inputName ,
78+ 'name ' => self ::getName ( $ field ) ,
7779 'description ' => "Possible values for the " . self ::$ name .". " ,
7880 'values ' => $ options ,
7981 ]);
@@ -110,4 +112,13 @@ public static function inputField($field)
110112 ];
111113 });
112114 }
115+
116+ public static function getName (Field $ field = null )
117+ {
118+ if ($ field instanceof Field) {
119+ return Utils::normalizeTypeName ("{$ field ->name }" .self ::$ inputName );
120+ }
121+
122+ return self ::$ inputName ;
123+ }
113124}
0 commit comments