New CollapseContainedItems Setting for Contained Item Behavior, Lombiq Email Client Orchard Core module - This week in Orchard (04/04/2025)
This week's topics include a new CollapseContainedItems Setting for Contained Item Behavior, ensuring content type restrictions for drag & drop in widgets, and our new Email Client Orchard Core module! Check out our post for the latest news!
Orchard Core updates
Ensure Content Type Restrictions are Enforced for Drag & Drop in Widgets
This is about fixing an issue when using drag & drop in the widget zone, content type restrictions were not applied. Let's say we have a Page content type with a Flow Part attached. Our goal here would be to be able to add PageSection widgets to our Page. And the PageSection widget also has a Flow Part attached, but users can only add the built-in Paragraph widgets. This means that when users create a new Page content item and add a PageSection widget, they will have two different Flow Part editors.
In the picture above, you can see that we first edited the Flow Part of the Page content type. We said that this flow can only contain PageSection content types. Below that window, you can see that we edited the Flow Part of the PageSection content type, where we said that this flow can only contain Paragraph content types.
Before this change, you could drop the Paragraph widget into the flow of the Page content type. But when you publish this Page, you will get the message that the widget has no matching content type definition and that it will be lost after publishing. Check out the fix in action!
Here, we edited a Page content type and added PageSection widgets to it. We also added a Paragraph widget to one of the PageSections. However, we cannot drop the Paragraph widget out of the PageSections because the flow of the Page content type only allows adding PageSection widgets.
New CollapseContainedItems Setting for Contained Item Behavior
While we are talking about Flow Parts, a new CollapseContainedItems setting has been added to BagPartSettings and FlowPartSettings, allowing users to control whether contained items are collapsed or expanded by default. To ensure consistency, both Bag Part and Flow Part now default to expanding contained items when the page loads.
Let's edit our existing Page content type and hit Edit near its Flow Part. Here, you can see the new Collapse Contained Items checkbox. Put a tick in it and edit one of our existing Page content items. Once Orchard loads the content item editor, you can see that both added PageSection widgets are collapsed by default.
News from the community
New Lombiq Email Client Orchard Core module
We created an email client for Orchard Core that can fetch emails (including attachments) from a server. Right now, it supports IMAP only. There's also a feature that can sync emails periodically from a background task in an extensible way; you can create your content items from emails, for example.
We also have some samples that use the Lombiq Email Client for Orchard Core module. There, you can see how to fetch emails from IMAP and how to sync emails.
The ImapController demonstrates how to fetch email from an IMAP server. Inside the Index action, we filter emails from the IMAP server where the subject contains the "important" word and list them to the user.
If the Email Sync feature is enabled, a background task automatically fetches emails from the configured IMAP server. An email sync event handler can be implemented to process these emails. You can trigger the email sync manually by using the IEmailSyncService service. As you can see, the SyncNextEmailsAsync method checks the UID of the last email that was synced, fetches emails after the last synced UID, and triggers the event handlers for each email.
If you want to quickly try out this new module and see it in action, clone our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!
Orchard Dojo Newsletter
Lombiq's Orchard Dojo Newsletter has 457 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published in Orchard Dojo, including This week in Orchard, of course.
Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!