URI components Liquid accessors, Lombiq JSON Editor - This week in Orchard (15/09/2021)

Gábor Domonkos's avatar
Documentation, This week in Orchard, Content field, Workflows, Liquid

Add Cc and Bcc to Workflow Email Task, URI components Liquid accessors, Lombiq JSON editor, and many more coming this week! Do you want to know more? Then it's time to check out our current post!

Orchard Core updates

Add Cc and Bcc to Workflow Email Task

If you would like to send an email using Workflows, you can use the Email Task to achieve your goal. Simply navigate to the admin UI of Orchard Core and go to Workflows (don't forget to enable the Workflows and the Email features) to create a new workflow. If you add a new Email Task to your workflow, you will see that this task has now two new fields: the Cc and the Bcc.

Adding Cc and Bcc to the Email Task

RegisterUserTask: Subject & Template for confirmation email should not be required if Send Email is unchecked

And while we are talking about the workflows, let's check out another workflow task, the Register User Task which registers users from form fields. When adding this task to your workflow, you can easily say that I want to send a confirmation email to the newly registered user with this subject and template. The issue was that the subject and the template for the confirmation email were required even if Send Confirmation Email is not checked.

Send confirmation email in Register User Task

URI components Liquid accessors

By default, the Liquid templates have access to a common set of objects. You can easily access the properties of the content item that is currently being rendered, the authenticated user for the current request, the current site settings, and the current request itself of course.

Check out this page of the Orchard Core documentation to see all of the available properties on the Request object. If you use the Request object quite often, you will notice that this table now has new properties, like the QueryString, UriQueryString, Path, UriPath, PathBase, UriPathBase, Host, and UriHost.

Available properties on the Request object

Generate Rule Condition TargetUrl in a correct location

The rules module was designed with extensibility in mind; however, there is one line that is in the view for it, setting the TargetUrl property of the modal picker to the layers controller. It needs to be moved out of the view, and into the Layers controller so that the view can be used by other modules, pointing to different controllers.

Moving setting the rule condition target URL to the controller

Demos

Lombiq JSON Editor

The Lombiq JSON Editor is our Orchard Core module for displaying a JSON Editor like on jsoneditoronline.org. You can easily clone or download the module from this GitHub repository. If you want to quickly try out this project and see it in action, check it out in our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!

In this demo, we will go with the quicker way and use our Open-Source Orchard Core Extensions full Orchard Core solution. If you clone that repository and set up your site using any setup recipe, let's just navigate to the admin UI of Orchard Core, and under Configuration -> Recipes, you will find one called Lombiq Open Source Orchard Core Extensions - JSON Editor Sample that is about demoing the Lombiq JSON Editor module. Let's run the recipe!

Now let's see the list of the content items where you will find a new one called JSON Example Page. This page has a JSON Field which comes from the Lombiq JSON Editor module. It's using a tree editor by default that you can use to manipulate the content of the JSON inside. But of course, you can have other types of editor for your JSON if you want, like you can have a code editor with numbered lines with syntax highlighting or you can just use a pure text editor and so on.

The JSON Example Page

Using a simple json-editor tag helper you can easily render the JSON editor. You can pass a string value to the editor that will contain the JSON itself, pass the JsonEditorOptions class that contains several configuration values like EscapeUnicode, SortObjectKeys, and so on.

The json-editor tag helper

And you have several other options and use-cases for this JSON field. The JSON Example Page, which comes from the recipe, has a Liquid Part too that reads the values from the JSON field and prints the values in a simple list by using Liquid and JavaScript. Here is the display view of the JSON Example Page.

Displaying the JSON Example page

If you would like to know more about this new field, head to YouTube for a recording!

News from the community

New GraphQL sample in the Lombiq Training Demo for Orchard Core

The Lombiq Training Demo for Orchard Core is a demo Orchard Core CMS module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that includes the full source code - which is the recommended way. You can also use it as part of a solution that uses Orchard Core NuGet packages; however, it's harder to look under the hood of Orchard Core features.

And the module just got a new little GraphQL sample! Check it out if you would like to know more about Orchard Core's GraphQL module and learn how to extend the Orchard GraphQL APIs!

Training Demo Module GraphQL sample

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 226 subscribers! 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 whenever a new post is 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!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment