Drupal Implementation
•https://www.drupal.org/project/graphql
•https://github.com/drupal-graphql/graphql
•Drupal has schema support for Nodes, Views, etc
Slide 30
Slide 30 text
Drupal Implementation
•https://www.drupal.org/project/graphql
•https://github.com/drupal-graphql/graphql
•Drupal has schema support for Nodes, Views, etc
•Plugin architecture
Slide 31
Slide 31 text
Installation Note
Slide 32
Slide 32 text
Installation Note
•Download the module (or use drush dl graphql)
Slide 33
Slide 33 text
Installation Note
•Download the module (or use drush dl graphql)
•Run composer require webonyx/graphql-php at
root level (error otherwise)
Slide 34
Slide 34 text
Installation Note
•Download the module (or use drush dl graphql)
•Run composer require webonyx/graphql-php at
root level (error otherwise)
•Enable the module
Queries
•You can run this in the GraphQL Explorer
/graphql/?query=query%20{nodeQuery%20{entities%20{entityId,entityLabel}}}
Slide 39
Slide 39 text
Queries
•You can run this in the GraphQL Explorer
•What about the browser? You can copy the query and
pass it to the /graphql endpoint with the query
parameter:
/graphql/?query=query%20{nodeQuery%20{entities%20{entityId,entityLabel}}}
For examples:
graphql/tests/modules/graphql_plugin_test/src/Plugin/GraphQL/Fields
Annotations:
https://www.drupal.org/docs/8/api/plugin-api/
annotations-based-plugins
Slide 84
Slide 84 text
Custom Types: Settings Form
Slide 85
Slide 85 text
Custom Types: Settings Form
•A node is in the core entity types. But what about stuff
that isn’t?
Slide 86
Slide 86 text
Custom Types: Settings Form
•A node is in the core entity types. But what about stuff
that isn’t?
•Settings example
Slide 87
Slide 87 text
Custom Types: Settings Form
Slide 88
Slide 88 text
Custom Types: Settings Form
•Basic custom form for saving to Drupal::state()
Slide 89
Slide 89 text
Custom Types: Settings Form
get($args['settings_name'], []);
yield json_encode($settings);
}
}
Slide 90
Slide 90 text
Custom Types: Settings Form
/**
* A JSON Payload of the custom settings object.ResolveInfo
*
* @GraphQLField(
* id = "payload",
* secure = true,
* name = "Payload",
* type = "string",
* multi = true,
* arguments = {
* "settings_name" = "String"
* },
* )
*/
Slide 91
Slide 91 text
Custom Types: Settings Form
query{
Payload(settings_name:"thf_utility.gcib_settings")
}
Slide 92
Slide 92 text
Custom Types: Settings Form
{
"data": {
"Payload": [
"{
"text_cta": "See More",
"story_cta": "Read the Story",
"scroll_wheel_cta": "Continue",
"lens_cta": "View More",
"draw_cta": "Draw Now",
"quiz_cta": "Take the Quiz"
}"
]
}
}
Slide 93
Slide 93 text
Case Study
Slide 94
Slide 94 text
Case Study
•Two products
Slide 95
Slide 95 text
Case Study
•Two products
•One Cinder touchscreen
Slide 96
Slide 96 text
Case Study
•Two products
•One Cinder touchscreen
•One JS touchscreen
Slide 97
Slide 97 text
No content
Slide 98
Slide 98 text
What did we learn?
Slide 99
Slide 99 text
What did we learn?
•Empty structures/values break Cinder
Slide 100
Slide 100 text
What did we learn?
•Empty structures/values break Cinder
•Making queries consistent is a challenge
Slide 101
Slide 101 text
What did we learn?
•Empty structures/values break Cinder
•Making queries consistent is a challenge
•Decoupling is both a technical thing as well as a
philosophical thing
Slide 102
Slide 102 text
DEMO TIME
Slide 103
Slide 103 text
No content
Slide 104
Slide 104 text
No content
Slide 105
Slide 105 text
We’re
hiring.
Slide 106
Slide 106 text
No content
Slide 107
Slide 107 text
THANK YOU.
Mark Llobrera
Technology Director, Bluecadet Philadelphia
https://speakerdeck.com/mllobrera
@dirtystylus
@bluecadet