-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphql_api.graphql.inc
More file actions
163 lines (162 loc) · 4.58 KB
/
graphql_api.graphql.inc
File metadata and controls
163 lines (162 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/**
* @file
*/
use GraphQL\Type\Definition\Type;
use GraphQL\Type\Definition\ObjectType;
/**
* Implements hook_graphql_info().
*
* @return array
*/
function graphql_api_graphql_api_info() {
return [
'types' => [
'text_formatted' => new ObjectType([
'name' => 'text_formatted',
'fields' => [
'value' => array(
'type' => Type::string(),
'description' => t('Text'),
),
'summary' => array(
'type' => Type::string(),
'description' => t('Summary'),
),
'format' => array(
'type' => Type::string(),
'description' => t('Text format'),
),
]
]),
'field_item_file' => new ObjectType([
'name' => 'field_item_file',
'fields' => function () {
$schema = graphql_api();
$file_type = $schema->getObjectType('file_file');
if (module_exists('file_entity')) {
$file_type = $schema->getInterfaceType('file');
}
return [
'description' => [
'type' => Type::string(),
'description' => t('Alt')
],
'display' => [
'type' => Type::string(),
'description' => t('Display')
],
'file' => [
'type' => $file_type,
'description' => t('File')
]
];
}
]),
'field_item_image' => new ObjectType([
'name' => 'field_item_image',
'fields' => function () {
$schema = graphql_api();
$file_type = $schema->getObjectType('file_file');
if (module_exists('file_entity')) {
$file_type = $schema->getInterfaceType('file');
}
return [
'description' => [
'type' => Type::string(),
'description' => t('Alt')
],
'display' => [
'type' => Type::string(),
'description' => t('Display')
],
'alt' => [
'type' => Type::string(),
'description' => t('Alt')
],
'title' => [
'type' => Type::string(),
'description' => t('Title')
],
'width' => [
'type' => Type::float(),
'description' => t('Width')
],
'height' => [
'type' => Type::float(),
'description' => t('Height')
],
'file' => [
'type' => $file_type,
'description' => t('File')
]
];
}
]),
'socialfield' => Type::listOf(new ObjectType([
'name' => 'socialfield',
'fields' => [
'service' => [
'type' => Type::string(),
'description' => t('Service')
],
'url' => [
'type' => Type::string(),
'description' => t('URL')
],
'weight' => [
'type' => Type::int(),
'description' => t('Weight')
]
]
])),
'field_item_name' => new ObjectType([
'name' => 'field_item_name',
'fields' => [
'title' => [
'type' => Type::string(),
'description' => t('The title of the name.')
],
'given' => [
'type' => Type::string(),
'description' => t('The given name.')
],
'middle' => [
'type' => Type::string(),
'description' => t('The middle of the name.')
],
'family' => [
'type' => Type::string(),
'description' => t('The family of the name.')
],
'generational' => [
'type' => Type::string(),
'description' => t('The generational of the name.')
],
'credentials' => [
'type' => Type::string(),
'description' => t('The credentials of the name.')
]
]
]),
'field_item_link' => new ObjectType([
'name' => 'field_item_link',
'fields' => [
'title' => [
'type' => Type::string(),
'description' => t('The title of the link.')
],
'url' => [
'type' => Type::string(),
'description' => t('The URL of the link.')
],
// @todo convert attributes to JSON?
// 'attributes' => [
// 'type' => Type::string(),
// 'description' => t('The attributes of the link.')
// ],
]
])
]
];
}