Skip to content

Commit 414e5ed

Browse files
joaogaringitbook-bot
authored andcommitted
GitBook: [8.x-3.x] 22 pages modified
1 parent 3c8b237 commit 414e5ed

17 files changed

Lines changed: 170 additions & 169 deletions
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,36 @@
1-
[![Build Status](https://img.shields.io/travis/drupal-graphql/graphql.svg)](https://travis-ci.org/drupal-graphql/graphql)
2-
[![Code Coverage](https://img.shields.io/codecov/c/github/drupal-graphql/graphql.svg)](https://codecov.io/gh/drupal-graphql/graphql)
3-
[![Code Quality](https://img.shields.io/scrutinizer/g/drupal-graphql/graphql.svg)](https://scrutinizer-ci.com/g/drupal-graphql/graphql/?branch=8.x-3.x)
1+
# Introduction
42

5-
# GraphQL for Drupal
3+
[![Build Status](https://img.shields.io/travis/drupal-graphql/graphql.svg)](https://travis-ci.org/drupal-graphql/graphql) [![Code Coverage](https://img.shields.io/codecov/c/github/drupal-graphql/graphql.svg)](https://codecov.io/gh/drupal-graphql/graphql) [![Code Quality](https://img.shields.io/scrutinizer/g/drupal-graphql/graphql.svg)](https://scrutinizer-ci.com/g/drupal-graphql/graphql/?branch=8.x-3.x)
4+
5+
## GraphQL for Drupal
66

77
This module lets you craft and expose a [GraphQL](http://graphql.org/) schema for [Drupal 8](https://www.drupal.org/8).
88

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.
1110

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.
1512

1613
For ease of development, it includes the [GraphiQL](https://github.com/graphql/graphiql/) interface at`/graphql/explorer`.
1714

18-
## Installation
15+
### Installation
1916

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`.
2118

22-
## Quickstart
19+
### Quickstart
2320

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.
2522

26-
[![Headless Drupal with GraphQL from scratch - part 01](https://img.youtube.com/vi/Fx1Gz-BVNx8/0.jpg)](https://www.youtube.com/watch?v=Fx1Gz-BVNx8)
27-
[![Headless Drupal with GraphQL from scratch - part 02](https://img.youtube.com/vi/Q0hTG5ASzx0/0.jpg)](https://www.youtube.com/watch?v=Q0hTG5ASzx0)
23+
[![Headless Drupal with GraphQL from scratch - part 01](https://img.youtube.com/vi/Fx1Gz-BVNx8/0.jpg)](https://www.youtube.com/watch?v=Fx1Gz-BVNx8) [![Headless Drupal with GraphQL from scratch - part 02](https://img.youtube.com/vi/Q0hTG5ASzx0/0.jpg)](https://www.youtube.com/watch?v=Q0hTG5ASzx0)
2824

29-
## Example implementation
25+
### Example implementation
3026

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.
3428

35-
## Documentation
29+
### Documentation
3630

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.
4132

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:
4434

4535
* [https://www.amazeelabs.com/en/blog/graphql-introduction](https://www.amazeelabs.com/en/blog/graphql-introduction)
4636
* [https://www.amazeelabs.com/en/blog/drupal-graphql-react-apollo](https://www.amazeelabs.com/en/blog/drupal-graphql-react-apollo)
@@ -51,20 +41,30 @@ as well as other other contributed modules supporting it:
5141
* [https://www.amazeelabs.com/en/blog/extending-graphql-part-3-mutations](https://www.amazeelabs.com/en/blog/extending-graphql-part-3-mutations)
5242
* [https://www.amazeelabs.com/en/blog/dont-push-it-using-graphql-twig](https://www.amazeelabs.com/en/blog/dont-push-it-using-graphql-twig)
5343

54-
## Resources
44+
### Resources
5545

5646
* Project homepage: [https://www.drupal.org/project/graphql](https://www.drupal.org/project/graphql)
5747
* Contributing: [https://github.com/drupal-graphql/graphql](https://github.com/drupal-graphql/graphql)
5848

59-
## Related projects
49+
### Related projects
6050

6151
* GraphQL APQ [https://github.com/lucasconstantino/drupal-graphql-apq](https://github.com/lucasconstantino/drupal-graphql-apq)
52+
6253
> Drupal module for Automatic Persisted Queries compatible with the apollo-link-persisted-queries project's proposed protocol.
54+
6355
* GraphQL Metatag [https://github.com/drupal-graphql/graphql-metatag](https://github.com/drupal-graphql/graphql-metatag)
56+
6457
> Module that integrates the Metatag Drupal module with GraphQL.
58+
6559
* GraphQL Twig [https://github.com/drupal-graphql/graphql-twig](https://github.com/drupal-graphql/graphql-twig)
60+
6661
> Allows you to inject data into Twig templates by simply adding a GraphQL query.
62+
6763
* GraphQL Views [https://github.com/drupal-graphql/graphql-views](https://github.com/drupal-graphql/graphql-views)
64+
6865
> Adds support for views to GraphQL.
69-
* GraphQL Entity Definitions [https://www.drupal.org/project/graphql_entity_definitions](https://www.drupal.org/project/graphql_entity_definitions)
66+
67+
* GraphQL Entity Definitions [https://www.drupal.org/project/graphql\_entity\_definitions](https://www.drupal.org/project/graphql_entity_definitions)
68+
7069
> Adds structural entity information to GraphQL.
70+

doc/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Introduction
2+

doc/SUMMARY.md

100755100644
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# Summary
1+
# Table of contents
22

3-
* [Introduction](../README.md)
3+
* [Introduction](README.md)
4+
* [Introduction](...md)
45

56
## Getting started
67

7-
* [Getting started](getting-started/readme.md)
8+
* [Getting started](getting-started/getting-started.md)
89

910
## Queries
1011

11-
* [Introduction](queries/readme.md)
12+
* [Introduction](queries/queries.md)
1213
* [Querying nodes](queries/querying-nodes.md)
1314
* [Querying taxonomies](queries/querying-taxonomies.md)
1415
* [Querying routes](queries/routes.md)
@@ -18,7 +19,7 @@
1819

1920
## Mutations
2021

21-
* [Introduction](mutations/readme.md)
22+
* [Introduction](mutations/mutations.md)
2223
* [Creating mutation plugins](mutations/creating-mutation-plugins.md)
2324
* [Writing custom mutations](mutations/custom-mutations.md)
2425
* [Writing custom validations](mutations/custom-validations.md)
@@ -29,5 +30,5 @@
2930

3031
## Metatag / SEO
3132

32-
* [Metatag support](metatag/readme.md)
33+
* [Metatag support](metatag-seo/metatag.md)
3334

doc/authentication/introduction.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# Introduction
2+
13
Explain the basics of how authentication work in graphql + drupal
24

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,65 @@
1-
# Getting Started
1+
# Getting started
22

33
## Introduction
44

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.
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.
66

7+
## Who is this module for?
78

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.
1210

1311
A few examples of where the GraphQL module could be used:
1412

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\)
1715
* Mobile applications that need a persistent data store
1816
* IOT data storage
1917

20-
## Hello World (Quick Start)
18+
## Hello World \(Quick Start\)
2119

2220
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).
2521

26-
3. Login and navigate to `/graphql/explorer`
27-
(Configuration > Web Services > GraphQL > Schemas > Explorer)
22+
[http://graphql.org/learn/](http://graphql.org/learn/)
23+
24+
2. Install the module and enable GraphQL, as well as GraphQL Core \(machine names are `graphql` and `graphql_core` respectively\).
25+
3. Login and navigate to `/graphql/explorer` \(Configuration > Web Services > GraphQL > Schemas > Explorer\)
2826

29-
This will bring you to the GraphiQL explorer.
27+
This will bring you to the GraphiQL explorer.
3028

31-
4. **Read the comments** and then enter the following query in the left pane:
29+
4. **Read the comments** and then enter the following query in the left pane:
3230

33-
```graphql
31+
```graphql
3432
query {
3533
user: currentUserContext{
3634
...on User {
3735
name
3836
}
3937
}
4038
}
41-
```
39+
```
4240

43-
5. Press `Ctrl-Space` and you should see something like the following display in the right pane:
44-
45-
```json
41+
5. Press `Ctrl-Space` and you should see something like the following display in the right pane:
42+
43+
```javascript
4644
{
4745
"data": {
4846
"user": {
4947
"name": "admin"
5048
}
5149
}
52-
```
53-
54-
6. Congrats! You just figured out how to execute your first GraphQL query. This query is displaying the current logged in user, you.
50+
```
5551
52+
6. Congrats! You just figured out how to execute your first GraphQL query. This query is displaying the current logged in user, you.
5653
5754
**NOTES:**
55+
5856
* 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.
59-
* 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.
57+
* 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.
6058
* 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.
6159
* 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.
6260
63-
6461
**Resources**
65-
* https://github.com/drupal-graphql/graphql
66-
* https://drupal.slack.com - The GraphQL Slack Channel is very active
62+
63+
* [https://github.com/drupal-graphql/graphql](https://github.com/drupal-graphql/graphql)
64+
* [https://drupal.slack.com](https://drupal.slack.com) - The GraphQL Slack Channel is very active
65+
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# Metatag support
2+
13
## Metatag
24

35
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.
46

57
## Metatag Queries
68

7-
```
9+
```text
810
{
911
nodeById(id: "1") {
1012
entityId
@@ -19,9 +21,9 @@ The easiest way to use the Metatag module together with GraphQL is to use the [G
1921
}
2022
```
2123

22-
This will give you something like this as a response :
24+
This will give you something like this as a response :
2325

24-
```
26+
```text
2527
{
2628
"data": {
2729
"nodeById": {
@@ -43,9 +45,9 @@ This will give you something like this as a response :
4345

4446
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.
4547

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 :
4749

48-
```
50+
```text
4951
{
5052
route(path: "/article-name") {
5153
... on EntityCanonicalUrl {
@@ -59,12 +61,11 @@ You can of course use this in any kind of query that would return the entity tha
5961
}
6062
}
6163
}
62-
6364
```
6465

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.
6667

67-
```
68+
```text
6869
{
6970
"data": {
7071
"route": {
@@ -86,17 +87,17 @@ This would return any information on this particular route, including the meta i
8687
}
8788
```
8889

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).
9091

9192
### Known issues
9293

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 :
9495

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."_
9697

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.
9899

99-
```
100+
```text
100101
<?php
101102
102103
namespace Drupal\graphql_custom\Plugin\GraphQL\Scalars;
@@ -119,3 +120,4 @@ class MetatagScalar extends StringScalar {
119120
120121
}
121122
```
123+

0 commit comments

Comments
 (0)