In our post, we show you the new GraphiQL-explorer that makes much easier to write queries in GraphiQL. Then we will see the localization improvements in Orchard Core and a new module that provides Form.io integration to build forms! Check out our post for more!
On Orchard Core
Added GraphiQL-explorer to the GraphiQL page
GraphiQL-explorer is a plugin for GraphiQL that adds a new technique to explore and build GraphQL queries. It adds a graphical representation of available fields and inputs that can be used in queries. It also allows constructing full queries by clicking through available fields and inputs without the repetitive process of typing these queries out by hand!
So, let's try the GraphiQL-explorer! First, set up your site using the Blog recipe and enable the GraphQL module. Now if you head to the GraphiQL option under the Configuration menu you will see the following screen.
In the explorer, you just need to click and enter the values directly from there from this tree preview that will build a query for you. So, you don't have to type to see the available things and to autocomplete, it lists everything. Everything is based on metadata. Let's say we would like to query the published blog posts in a descending order, where the author is admin.
The PR containing the GraphiQL-explorer is merged to dev, so check out to the latest commit on the dev branch and test this feature now!
Implementation notes for decoupled CMS
Dody Gunawinata documenting his experience with Orchard Core by commenting on issues in GitHub. Under this issue you can find full of suggestions for the users who want to start a decoupled site, and for the maintainers to improve the experience. In this issue, he writes a running commentary and notes for a decoupled CMS website implementation that it can be a reference for official documentation/guide. There are many useful comments and suggestions in this thread, so if you are planning to implement a decoupled CMS website using Orchard Core, you should definitely read his notes!
If you go to the admin site, the localization settings for the culture and the supported cultures are not in the General settings anymore, it moved to a new Localization option because they come from the Localization feature.
There is always a default culture and the default culture is always part of the supported cultures. You can add here as many supported cultures as you want from the list and select the default culture using a radio button.
Let's visit the site with a browser that sends Accept-Language: en. Let en be a supported culture, but not the default one. If we print the current culture here (
@System.Globalization.CultureInfo.CurrentUICulture.Name) you could see it's fallback to en. If we ask for a culture that doesn't supported, it will fall back to Hungarian, because it's the default one.
If we remove en from the list of supported cultures, the value of the current culture will be hu-HU, because that's our default one. The browser asks for en, but it's not supported.
One more thing: if you add a culture from the list, it will automatically remove it from the list to prevent you to add that culture multiple times. If you delete a culture it will be available in the list again.
And now if you want to get the default culture and the supported cultures from code, you should resolve the ILocalizationService in the OrchardCore.Abstractions module.
Form.io integration to build forms in Orchard Core
There will be a new module that's integrating Form.io into a part, therefore you can use Form.io to build forms and hook it up to a workflow in Orchard Core.
By enabling this module you will get a new content type, called Simple Form. If you create a new Simple Form, you will get the familiar Form Builder that comes from Form.io. You can define the URL to submit the form to and the HTTP method to use when submitting the form.
If we save the content item without specifying the action and submit the form, we will see a message: "Please specify an endpoint. Data to submitted:". The metadata contains stuff that provided by Form.io and the submission contains the data that comes from the form.
Let's see how you can use it in a workflow. Let's start the workflow with an Http Request Event that triggers the workflow with an URL that is invokable. This will be the URL that we need to call when submitting the Simple Form.
This module is in development and isn't available yet, but in the closer future, it may be downloadable as an open source module. Thanks for the hard work on this for Jean-Philippe Tissot!
Orchard Dojo Newsletter
Now we have 69 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail every time when a new post published to Orchard Dojo, including This week in Orchard of course.
Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!