![]() ![]() On the top right you should have a link called Docs which will expand the Documentation Explorer on click. For this, just install the GraphQL Explorer module, and then navigate to /graphql/explorer on your site. ![]() There is a tool called GraphiQL which you can use to run GraphQL queries and also check the schema. Now, how can you be sure that what you did has really changed the schema. You just exposed your view to the GrapqQL schema. Let's change the machine name to graphql_articles. To do that, just go to edit your view and add a GraphQL display. The second thing we want to expose is the Articles view. Let's say we want to expose the body field(the title is automatically exposed). Next you can go to the Manage display tab of the Article content type ( /admin/structure/types/manage/article/display), and configure the GraphQL display. Don't forget to click on the Save configuration button. Go to admin/structure/display-modes/view and create the new view mode. Now you can go back to admin/config/graphql/content, click again on Content and Article and you should be able to select GraphQL from the view modes list. I recommend creating a new one, let's call it graphql, so that you can easily see it is used to expose data to GraphQL. So before actually exposing the Article bundle, we need to configure a view mode. And you do that by selecting a View mode. ![]() Then you have the possibility to choose which fields to expose. We want to expose the Article content type, so just click on Content and then Article. To expose content, just go to /admin/config/graphql/content and there you should see a list with all your entity types and bundles that you can expose. You don't have to write it yourself, you just have to expose your configuration. So now you have the Article content type (which was already there) and the Articles view which you just created, and you want to expose them via GraphQL. For this, you need a schema. Be sure to also create a simple view that lists articles (don't worry about displays right now, just list the title of them). We want to list some articles, so just go ahead and create a few (or use the Devel generate module if you want). For now, we will just install the GraphQL Content and the GraphQL Views modules (they will automatically install the GraphQL and GraphQL Core dependencies). Additionally, you should also download the GraphQL module or clone it from. Nothing special to mention here, just do a plain Drupal 8 installation. Drupal SetupĪs mentioned, the first thing you'll need to do is to install Drupal. For this third thing, we will use GraphQL and Apollo. This time, it will be less technical and focused on content management aspect.There are 3 things you'll need to build this: Drupal, React and something that can bind those two together, meaning that it can fetch the data from Drupal and make it available in React. This session has been introduced at Drupalcamp Poland 2018. You will see how lean the custom codebase on Drupal side can be, permitting to achieve amazing results in no time. GraphQL-related performance and security considerations writing custom GraphQL resolver or overriding existing resolvers practical examples of GraphQL queries used to retrieve page content flexible sitebuilding - utilizing Paragraphs to structure content in Drupal to allow content editors to create appealing pages in no time Most importantly, I will show real-life examples from our journey that anybody willing to utilize GraphQL finds indispensable: Starting with introduction of GraphQL, I will then briefly explain the basic concepts of the language, illustrate the problems it aims to solve, why it was developed and why we chose it. ![]() I will introduce our multisite environment, where content from multiple Drupal installations is served by one universal Angular application and how GraphQL helped us minimize the amount of coding required on Drupal side and shift our focus to frontend. I will demonstrate how we successfully utilized Drupal and GraphQL to build a modern customer-facing enterprise web platform and explain it from the architecture point of view. What does it take to create a complex, fully decoupled website where Drupal is just managing content and all rendering is performed by a client-side single page application? Surprisingly little. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |