This week in Orchard - 11/05/2018

This week in Orchard

Interested in the new features of the GraphQL Explorer or the GraphQL API? Or the announcement of the Orchard Core Commerce: The commerce module for Orchard Core?

On Orchard Core

First let us to mention you some of the newest posts from David Hayden's blog!

Overriding Theme Shapes with Templates in Orchard Core CMS

The Blog Theme in Orchard Core has a Content-Article.liquid file. This is the shape responsible for displaying an article. In this post he shows how to change the hardcoded background image of the article by adding a Media Field to the Article content type to be able the users to select any image.

Adding a New Zone to The Blog Theme Layout in Orchard Core CMS

In this tutorial, he shows how to add a new Zone, called Messages to the Blog Theme. Now can add any widgets to the Zone in the Orchard Core CMS website.

Develop a Custom Widget In Orchard Core CMS

In this tutorial you can read about how to create a new widget, called Alert Widget, that will allow one to easily display a Bootstrap alert on the website using the previously crated Messages Zone.

If you would like to read more exciting blog posts about Orchard and Orchard Core, don't forget to check out Orchard Blogs: the heartbeat of the Orchard CMS community: blog posts from Orchard-related blogs, scraped automatically. Created by Lombiq.

Orchard Core Commerce: The commerce module for Orchard Core

Orchard Core Commerce will be an Orchard port and partial rewrite of the open source Nwazet Commerce module that was built for Orchard CMS 1.x. Nwazet Commerce was initially built in 2012 by Bertrand Le Roy, loosely based on a commerce sample by Sipke Shoorstra. The initial goal of Nwazet Commerce was to power the web site of the hardware startup Nwazet. While Nwazet is no longer operating, the Nwazet Commerce project went on, and was further developed by a group of passionate contributors who are using the platform for their own, and their customer's web sites.

Like Orchard, Nwazet Commerce was built with extensibility in mind, and as such it has its own extensions (typical examples include local tax and shipping modules). It's also pure, idiomatic Orchard.

Orchard Core represents a major evolution of the Orchard design principles, and is sufficiently different that running Nwazet Commerce on it will necessitate significant work. As such, the team decided that starting from a blank slate was the best way to go, so they will port Nwazet Commerce piece by piece, being careful to accurately apply Orchard Core's new design principles. They also decided to adopt a new name, that gets rid of the now obsolete origins, and establishes their ambition for the module to become the go-to commerce module for Orchard Core.

This work is in its initial design phases. There's a lot of work to do, and yes, the team do welcome participation in any shape or form. If you would like to help to improve the Orchard Core Commerce module head to GitHub and check the available Issues!

Demos

GraphQL Explorer and GraphQL API

We mentioned the GraphQL feature earlier in this post and last week we saw how to Test the new tenant APIs using GraphQL. Now let's see the newest improvements of the GraphQL and the GraphQL API!

For the following demo we set up the site using the Blog recipe. We added several fields to the Article content type to demonstrate the capabilities of the GraphQL Explorer: a Link Field called Link, a Markdown Field called Description, a Media Field called Images, and a Content Picker Field called Posts.

When you enable the GraphQL module, you can go to admin/graphql, where you can find the GraphQL Explorer. You can use CTRL+Space to have an intellisense. You don't need to click the play button every time you want to run your query, you can hit CTRL+Enter to do the same.

In the Explorer you also have access to fields not just the parts. The Subtitle is a Text Field, that you can reach by simply type the name of the field.

The Link Field called Link has two properties: text and url.

You can get the HTML content of the HtmlBodyPart as well.

The field called Description is a Markdown Field. By accessing the html property of that field you can get the value of the markdown transformed to HTML.

The Images here is a Media Field. It's provide the URLs of the images that stored in the database and represents the media in the assets. But if you want to render these elements you need the public URL to point to this media. So instead of paths you can call urls.

When accessing a Content Picker Field (Posts in this case) you can get the contentItemIds or the content item itself.

But let's say you have many related content items and you just need the first one. By typing contentitems(first: 1) you will get only the wanted item. You can skip the first one by typing contentItems(skip: 1).

You can also do that with the collection of urls of the Media Field.

You have the ability to write if statements here. If the content item is a BlogPost, then give me the MarkdownBodyPart, but the HTML of the markdown. To do that on a collection of content items, you need to type ... on BlogPost {} and in the bracket you can define what would you like to query on.

You can write more complex queries like give me the blog posts and order them by their displayText or by the createdUtc. So you can order by properties. You can also combine this query by using the first or skip keyword here.

You can use the where keyword with several filters. For example, by using the displayText_contains, you can filter for a post that display text starts with a given query. Hit CTLR+SPACE to see what options are available.

With parameterized queries you can say that list me that blog posts where the display text starts with the value of the parameter. Now this query is parameterized by something, so you can reuse it or separate the query from the values.

In the previous post we mentioned how to use Orchard Core's authentication server to authenticate yourself when making a call to Orchard Core APIs. Now you can use the GraphQL API to make those requests.

On Lombiq

Mega Millions on Show Orchard

Show Orchard is an Orchard CMS showcase, displaying only the best Orchard CMS powered sites from around the web. The Mega Millions Jackpot website runs on Orchard too! So, added it to Show Orchard!

We just scratched the surface of the topics that the community had this week. If you are interested in the whole conversation, don't forget to head to YouTube for the recording of the current podcast!

No Comments

Add a Comment