File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 55use Youshido \GraphQL \Type \Object \AbstractObjectType ;
66use Youshido \GraphQL \Type \Scalar \StringType ;
77use Youshido \GraphQL \Type \Scalar \IntType ;
8+ use Youshido \GraphQL \Type \ListType \ListType ;
89use ProcessWire \GraphQL \Type \InterfaceType \PageFileInterfaceType ;
910
1011class PageImageType extends AbstractObjectType {
@@ -21,7 +22,7 @@ public function getDescription()
2122
2223 public function build ($ config )
2324 {
24-
25+
2526 $ config ->applyInterface (new PageFileInterfaceType ());
2627
2728 $ config ->addfield ('width ' , [
@@ -39,11 +40,19 @@ public function build($config)
3940 return (integer ) $ value ->height ;
4041 }
4142 ]);
43+
44+ $ config ->addField ('variations ' , [
45+ 'type ' => new ListType (new PageImageType ()),
46+ 'description ' => 'Returns all size variations of the image. ' ,
47+ 'resolve ' => function ($ value ) {
48+ return $ value ->getVariations ();
49+ }
50+ ]);
4251 }
4352
4453 public function getInterfaces ()
4554 {
4655 return [ new PageFileInterfaceType () ];
4756 }
4857
49- }
58+ }
You can’t perform that action at this time.
0 commit comments