Generic Site Settings Deployment Step, Extensible filters for contents admin list - This week in Orchard (17/07/2020)

Gábor Domonkos's avatar
Admin UI, Media Library, Documentation, This week in Orchard

The community has just released RC 2 a few weeks ago, but ever since Orchard Core has got several new features. This week among others we are going to see the extensible filters for contents admin list and the generic site settings deployment step.

Orchard Core updates

New column to the media library table view

Enter the dashboard of your Orchard Core site and navigate to Content -> Media Library. Here you can view the uploaded files in a list view and in a grid view. You can switch between them using the little icons on the left side of the Filter textbox. If you view the files using the list view you will see a new column called LastModify. You can also sort the items by clicking on the header of the LastModify column.

LastModify column in the List view of the Media Library

Extensible filters for contents admin list

You can extend what filters are available in the contents admin list and each module can provide their own filters. Let's see this feature closely!

First, install your site using the Blog recipe. Now, head to Configuration -> Features and enable the Taxonomies Contents List Filters and the Content Localization modules. The Content Localization is about to provide a part that allows localizing content items. The Taxonomies Contents List Filters feature is adding a new option under Configuration -> Settings -> Taxonomy Filters where you can select the taxonomies to filters in the contents list. As you can see, the Blog recipe comes with two predefined taxonomies: Tags and Categories. Let's select both ones.

Taxonomy filters settings

Now, head to Content -> Content Items, where you could see three new drop-downs. Categories and Tags can be used to filter by the values of the Category and the Tag Term content type. Just for the sake of demonstration make the Blog Post content type listable to see the Blog Post content items in the content items list. After if you select to filter for the content items that have the Earth tag, you will see the default one, because that post has each of these three existing posts.

Filter by tags in the content items list

And you can easily add your own filters for the content items list! Without going into the details you have to add a new driver by implementing the DisplayDriver<ContentOptionsViewModel> abstract class and implement the IContentsAdminListFilter interface where you can provide the logic for filtering - modify the query (IQuery<ContentItem>) - content items. Check the TaxonomyContentsAdminListDisplayDriver.cs and the TaxonomyContentsAdminListFilter.cs files to see good examples about how to create your own filters.

There was a demo about the new content filters and in the case, if you haven't seen it yet, you can watch the recording here.

Demo videos in docs

From time to time, the members of the community will do demos to show the latest features and improvements of the CMS. These videos are very helpful if you would like to learn a given topic (for example how to create Custom Settings using the admin UI) and you prefer videos. Now every topic in the documentation of Orchard Core containing the recording that is about showing you how to use the given feature. If we stay at the same example we will see the video at the bottom of the Custom Settings page.

Demo videos in the documentation

Add and implement IsJson() string extension method

We are sure that you will meet some code in the future that is using JSON in their editor templates and you want to/need to validate that the text supplied in the editor is valid JSON. Now you can find a string extension method called IsJson() in the OrchardCore.Mvc.Utilities classes to do this.

The IsJson extension method


Generic Site Settings Deployment Step

When you navigate to the GitHub page of Orchard Core and list the open issues you will find one that is about listing the missing deployment steps, which means some settings do not have a deployment step to import and export them. The goal here is to be able to import/export every setting. For that, we have to get familiar with the notion of Generic Site Settings Deployment Step.

You will find a new class library called OrchardCore.Settings.Core, where is a folder named Deployment that is containing logic to add site settings to a DeploymentPlanResult, a generic display driver that is responsible for the UI of the deployment plan and many more. Feel free to discover the content of this project!

The SiteSettingsPropertyDeploymentSource class

Now let's jump to the OrchardCore.Admin module. If you want to handle the custom settings via the OrchardCore.Settings.Core library, don't forget to reference it in your project. If you do that you can easily import/export the settings in your deployment plan. There is a class called AdminSettings in the OrchardCore.Admin module that contains one DisplayMenuFilter boolean property. Let's make it importable/exportable! Head to the Startup.cs file of the module and check out the DeploymentStartup class of it. Here you can see how you can use the provided generic business logic from the OrchardCore.Settings.Core project.

The DeploymentStartup class in the Admin module

You can see that we created a new deployment plan with the name: Admin settings and the description: Exports the admin settings by just passing these localized strings to the SiteSettingsPropertyDeploymentStepDriver. That's an easy and generic way to implement a deployment plan for your settings in your module!

Deployment steps to export settings

If you would like to know more about the generic site settings deployment step, head to YouTube!

News from the community

Intensive Orchard Core training for the In Motion team

We had the opportunity to provide a five-day intensive Orchard Core training for the In Motion team! Read our post to know more details about the training!

Post about the training for the In Motion team

Orchard Core workshops

The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events.

Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage!

Orchard Dojo Newsletter

Now we have 152 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 whenever 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!

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