You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module lets you craft and expose a [GraphQL](http://graphql.org/) schema for [Drupal 8](https://www.drupal.org/8).
8
8
9
-
It is is built around [https://github.com/webonyx/graphql-php](https://github.com/webonyx/graphql-php). As such, it supports
10
-
the full official GraphQL specification with all its features.
9
+
It is is built around [https://github.com/webonyx/graphql-php](https://github.com/webonyx/graphql-php). As such, it supports the full official GraphQL specification with all its features.
11
10
12
-
You can use this module as a foundation for building your own schema through
13
-
custom code or you can use and extend the generated schema using the plugin
14
-
architecture and the provided plugin implementations form the sub-module.
11
+
You can use this module as a foundation for building your own schema through custom code or you can use and extend the generated schema using the plugin architecture and the provided plugin implementations form the sub-module.
15
12
16
13
For ease of development, it includes the [GraphiQL](https://github.com/graphql/graphiql/) interface at`/graphql/explorer`.
17
14
18
-
## Installation
15
+
###Installation
19
16
20
-
This module requires composer for installation. To install, simply run ``composer require drupal/graphql``.
17
+
This module requires composer for installation. To install, simply run `composer require drupal/graphql`.
21
18
22
-
## Quickstart
19
+
###Quickstart
23
20
24
-
To get a quick overview from the __query__ part of GraphQL in action watch the following video's.
21
+
To get a quick overview from the **query** part of GraphQL in action watch the following video's.
25
22
26
-
[](https://www.youtube.com/watch?v=Fx1Gz-BVNx8)
27
-
[](https://www.youtube.com/watch?v=Q0hTG5ASzx0)
23
+
[](https://www.youtube.com/watch?v=Fx1Gz-BVNx8)[](https://www.youtube.com/watch?v=Q0hTG5ASzx0)
28
24
29
-
## Example implementation
25
+
###Example implementation
30
26
31
-
Check out [https://github.com/fubhy/drupal-decoupled-app](https://github.com/fubhy/drupal-decoupled-app) for a complete example
32
-
of a fully decoupled React and GraphQL application. Feel free to use that
33
-
repository as a starting point for your own decoupled application.
27
+
Check out [https://github.com/fubhy/drupal-decoupled-app](https://github.com/fubhy/drupal-decoupled-app) for a complete example of a fully decoupled React and GraphQL application. Feel free to use that repository as a starting point for your own decoupled application.
34
28
35
-
## Documentation
29
+
###Documentation
36
30
37
-
[Documentation](doc/SUMMARY.md) is heavily worked on, but still far from complete.
38
-
This is due to the vast amount of improvements and additional features we've
39
-
added to the module recently. As we are finishing up the 3.x version of this
40
-
module we will be re-doing the documentation and record a series of screencasts.
31
+
[Documentation](https://github.com/drupal-graphql/graphql/tree/3c8b237bc3698c82b05291d528fb6701e8d7b501/doc/SUMMARY.md) is heavily worked on, but still far from complete. This is due to the vast amount of improvements and additional features we've added to the module recently. As we are finishing up the 3.x version of this module we will be re-doing the documentation and record a series of screencasts.
41
32
42
-
These blog posts provide additional information on how to use and extend the module
43
-
as well as other other contributed modules supporting it:
33
+
These blog posts provide additional information on how to use and extend the module as well as other other contributed modules supporting it:
The GraphQL Drupal module lets you query or mutate (update/delete) any content or configuration using the official GraphQL query language. This is an extremely powerful tool which opens the door for Drupal to be used in a multitude of applications.
5
+
The GraphQL Drupal module lets you query or mutate \(update/delete\) any content or configuration using the official GraphQL query language. This is an extremely powerful tool which opens the door for Drupal to be used in a multitude of applications.
6
6
7
+
## Who is this module for?
7
8
8
-
9
-
## Who is this module for?
10
-
11
-
Anyone who wants to get JSON data out of Drupal.
9
+
Anyone who wants to get JSON data out of Drupal.
12
10
13
11
A few examples of where the GraphQL module could be used:
14
12
15
-
* Decoupled Drupal applications with a javascript front-end (React, Angular, Ember, etc),
16
-
* Twig Templates (Drupal theming)
13
+
* Decoupled Drupal applications with a javascript front-end \(React, Angular, Ember, etc\),
14
+
* Twig Templates \(Drupal theming\)
17
15
* Mobile applications that need a persistent data store
18
16
* IOT data storage
19
17
20
-
## Hello World (Quick Start)
18
+
## Hello World \(Quick Start\)
21
19
22
20
1. Familiarize yourself with the GraphQL language. The official GraphQL docs are very well written.
23
-
http://graphql.org/learn/
24
-
2. Install the module and enable GraphQL, as well as GraphQL Core (machine names are `graphql` and `graphql_core` respectively).
25
21
26
-
3. Login and navigate to `/graphql/explorer`
27
-
(Configuration > Web Services > GraphQL > Schemas > Explorer)
6. Congrats! You just figured out how to execute your first GraphQL query. This query is displaying the current logged in user, you.
56
53
57
54
**NOTES:**
55
+
58
56
* The GraphiQL explorer, included with the module, is your friend, it’s amazing. You will most likely use the GraphiQL explorer to build and test more complicated queries.
* GraphQL is introspective, meaning that the entire schema \(data model\) is known up front. This is important as it allows tools like GraphiQL to implement autocompletion.
60
58
* You can use GraphiQL to explore your way through the data and configuration, once you know the basic GraphQL syntax. You can use the tab key in the explorer like you would with autocompletion or intellisense in modern IDEs.
61
59
* The `... User` in the query above is a fragment which exposes all of the fields on the User entity to us. Inline fragments like this can be a very powerful way to explore the schema.
Copy file name to clipboardExpand all lines: doc/metatag-seo/metatag.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
+
# Metatag support
2
+
1
3
## Metatag
2
4
3
5
The easiest way to use the Metatag module together with GraphQL is to use the [GraphQL Metatag](https://www.drupal.org/project/graphql_metatag) module. It comes with built-in support for using metatags with GraphQL.
4
6
5
7
## Metatag Queries
6
8
7
-
```
9
+
```text
8
10
{
9
11
nodeById(id: "1") {
10
12
entityId
@@ -19,9 +21,9 @@ The easiest way to use the Metatag module together with GraphQL is to use the [G
19
21
}
20
22
```
21
23
22
-
This will give you something like this as a response :
24
+
This will give you something like this as a response :
23
25
24
-
```
26
+
```text
25
27
{
26
28
"data": {
27
29
"nodeById": {
@@ -43,9 +45,9 @@ This will give you something like this as a response :
43
45
44
46
This way you can easily manipulate SEO information in the Node in Drupal but still be able to properly inject this in your application by fetching this information out of the node.
45
47
46
-
You can of course use this in any kind of query that would return the entity that holds the metatag information. As an example querying a route and getting from that entity the metatag information would look something like this :
48
+
You can of course use this in any kind of query that would return the entity that holds the metatag information. As an example querying a route and getting from that entity the metatag information would look something like this :
47
49
48
-
```
50
+
```text
49
51
{
50
52
route(path: "/article-name") {
51
53
... on EntityCanonicalUrl {
@@ -59,12 +61,11 @@ You can of course use this in any kind of query that would return the entity tha
59
61
}
60
62
}
61
63
}
62
-
63
64
```
64
65
65
-
This would return any information on this particular route, including the meta information requested.
66
+
This would return any information on this particular route, including the meta information requested.
66
67
67
-
```
68
+
```text
68
69
{
69
70
"data": {
70
71
"route": {
@@ -86,17 +87,17 @@ This would return any information on this particular route, including the meta i
86
87
}
87
88
```
88
89
89
-
for more information on routes check out the [routes documentation](queries/routes.md). Writting custom plugins you could also mutate fields of this type. You can learn more about these in the section [Creating mutation plugins](mutations/creating-mutation-plugins.md).
90
+
for more information on routes check out the [routes documentation](https://github.com/drupal-graphql/graphql/tree/3c8b237bc3698c82b05291d528fb6701e8d7b501/doc/metatag/queries/routes.md). Writting custom plugins you could also mutate fields of this type. You can learn more about these in the section [Creating mutation plugins](https://github.com/drupal-graphql/graphql/tree/3c8b237bc3698c82b05291d528fb6701e8d7b501/doc/metatag/mutations/creating-mutation-plugins.md).
90
91
91
92
### Known issues
92
93
93
-
There is a currently an [issue](https://github.com/drupal-graphql/graphql/issues/609) opened for using the metatag module together with the GraphQL module :
94
+
There is a currently an [issue](https://github.com/drupal-graphql/graphql/issues/609) opened for using the metatag module together with the GraphQL module :
94
95
95
-
*"If a module (e.g. metatag) introduces a new primitive data type, it is not part of the derived types, but any field using it will reference it. That results in a "Missing type metatag." exception."*
96
+
_"If a module \(e.g. metatag\) introduces a new primitive data type, it is not part of the derived types, but any field using it will reference it. That results in a "Missing type metatag." exception."_
96
97
97
-
So for now you need to include a custom Scalar as a workaround to avoid errors in GraphQL due to this missing type. Create a file inside a custom module of your own, named for example "MetatagScalar.php" where a custom scalar will be defined. In this example the module's name is graphql_custom as seen from the namespace bellow. Make sure to not conflict with existing namespaces when defining it.
98
+
So for now you need to include a custom Scalar as a workaround to avoid errors in GraphQL due to this missing type. Create a file inside a custom module of your own, named for example "MetatagScalar.php" where a custom scalar will be defined. In this example the module's name is graphql\_custom as seen from the namespace bellow. Make sure to not conflict with existing namespaces when defining it.
0 commit comments