1+ <?php
2+
3+ namespace ProcessWire \GraphQL \Type \Object ;
4+
5+ use Youshido \GraphQL \Type \Object \AbstractObjectType ;
6+ use Youshido \GraphQL \Type \Scalar \FloatType ;
7+ use Youshido \GraphQL \Type \Scalar \IntType ;
8+ use Youshido \GraphQL \Type \Scalar \StringType ;
9+
10+ class MapMarkerType extends AbstractObjectType {
11+
12+ public function getName ()
13+ {
14+ return 'MapMarker ' ;
15+ }
16+
17+ public function getDescription ()
18+ {
19+ return 'Represents the `FieldtypeMapMarker` value. ' ;
20+ }
21+
22+ public function build ($ config )
23+ {
24+ $ config ->addField ('lat ' ,[
25+ 'type ' => new FloatType (),
26+ 'description ' => 'The latitude of the MapMarker. ' ,
27+ 'resolve ' => function ($ value ) {
28+ return (float ) $ value ->lat ;
29+ }
30+ ]);
31+
32+ $ config ->addField ('lng ' ,[
33+ 'type ' => new FloatType (),
34+ 'description ' => 'The longitude of the MapMarker. ' ,
35+ 'resolve ' => function ($ value ) {
36+ return (float ) $ value ->lng ;
37+ }
38+ ]);
39+
40+ $ config ->addField ('address ' ,[
41+ 'type ' => new StringType (),
42+ 'description ' => 'The address of the MapMarker. ' ,
43+ 'resolve ' => function ($ value ) {
44+ return (string ) $ value ->adress ;
45+ }
46+ ]);
47+
48+ $ config ->addField ('zoom ' ,[
49+ 'type ' => new IntType (),
50+ 'description ' => 'The zoom of the MapMarker. ' ,
51+ 'resolve ' => function ($ value ) {
52+ return (integer ) $ value ->zoom ;
53+ }
54+ ]);
55+ }
56+
57+ }
0 commit comments