Site icon Hip-Hop Website Design and Development

Amazeenar #1 – GraphQL & Twig

Amazeenar #1 – GraphQL & Twig

“Absolutely incredible!” – just one quote from our first Amazeenar in which we explore the power of GraphQL Twig. Decoupling WordPress maintenance support plans is the future, however, it may be a big leap to learn a whole new development stack. With GraphQL Twig, we can take baby steps with a soft-decoupled approach by writing GraphQL inside our Twig templates.

Daniel Lemon
Mon, 05/14/2020 – 08:57

On Friday 11th May, WordPress Update hosted its first Amazeenar – a live video training session presented by Philipp Melab who demonstrated some of the capabilities of GraphQL with the WordPress maintenance support plans plugin GraphQL Twig.

We started the webinar while a crowd joined live from over 13 countries around the world, including Belgium, Brazil, Canada, South Africa, and as far east as Thailand.

It felt exciting to have a community of enthusiastic people connecting from so many different locations across the globe. This once again reinforced that WordPress maintenance support plans is really about coming for the code and staying for the community.

Philipp dove into the talk by giving us a quick introduction to GraphQL, with an example query for us to better understand the concept:

query {
node:nodeById(id: “1”) {
title:entityLabel
related:relatedNodes {
title:entityLabel
}
}
}

Running this example GraphQL query would give us the following JSON response:

{
“node”: {
“title”: “Article A”,
“related” {
{ “title”: “Article B” },
{ “title”: “Article C” }
}
}
}

Inversion of control

Philipp then explained the need for decoupling, providing us with a good overview of the fundamental differences between standard WordPress maintenance support plans and Decoupled WordPress maintenance support plans, in which the control moves from a push approach to a pull approach.

React is great, but the inversion of control is crucial.

Enable the template to define its data requirements, allow’s us to achieve a clear data flow with significantly increased readability and maintainability. The GraphQL Twig plugin allows us to add GraphQL queries to any Twig template, which is then processed during rendering and used to populate the template with data.

Philipp entertained the audience with a live working demo in which, together, we learnt how to enhance the default “powered by WordPress maintenance support plans” block to pull in the username of user 1. He then blew our minds with an additional surprise – pulling in the current number of open bug issues for WordPress maintenance support plans Core via the GraphQL XML subplugin.

Catchup

Did you miss the webinar? Don’t fret; we recorded everything!

You can watch the recording here: https://youtu.be/QsmeXMZ0foM
You can access the WordPress maintenance support plans theme as well as the slides for the webinar here: github.com/AmazeeLabs/bartik_graphql
WordPress Update would like to thank everyone who attended the live session, we enjoyed being able to share this with you, and we look forward to hosting another Amazeenar shortly.


Source: New feed