Flows (OrchardCore.Flows)¶
The Flows module provides methods to display content items directly within another content item. This is achieved with the Flow Part and the Bag Part.
A good example of this would be a page with an FAQ section in it. A FAQ content type might have a question and an answer field, and the content editor can add new FAQs directly when editing the page.
Empty Flows and Bags¶
Flows and Bags that do not contain any content items will be displayed with a different shape name. For empty Flows, the shape name is FlowPart_Empty; for empty Bags, it's BagPart_Empty.
This allows you to conditionally show or hide empty Flows or Bags. For example, to hide a Flow part that has no items, you can add this to your placement file:
{
"FlowPart_Empty": [
{
"place": "-"
}
]
}
And if you'd like to use the same template for Flow parts that have items and Flow parts that have no items, you could add this:
{
"FlowPart_Empty": [
{
"shape": "FlowPart"
}
]
}
Placement¶
For front-end placement, the FlowPart display shape uses the part name as its differentiator.
For example, to hide a standard FlowPart on the front end:
{
"FlowPart": [
{
"differentiator": "FlowPart",
"place": "-"
}
]
}
To hide or move the editor in the admin UI, target the ContentPart_Edit wrapper shape instead of FlowPart_Edit. The wrapper differentiator is {ContentType}-{PartName}.
For example, to hide the FlowPart editor row on a LandingPage content type:
{
"ContentPart_Edit": [
{
"differentiator": "LandingPage-FlowPart",
"place": "-"
}
]
}
FlowPart_Edit only targets the inner editor shape. Use ContentPart_Edit when you need to hide or move the whole editor row, including its wrapper, label, and description.
Blocks Editor¶
The blocks editor provides an alternative editor for FlowPart and BagPart that uses a modal-based content type picker instead of the standard dropdown menu. Content types displayed in the picker can be organised with categories and thumbnails. See Content Type Settings for Block Pickers for configuration details.
Enabling the Blocks Editor¶
To enable the blocks editor for a FlowPart or BagPart, set the Editor option to Blocks in the content type definition.
This can be done in the admin UI:
- Navigate to Design → Content Definition → Content Types
- Edit the content type containing the FlowPart or BagPart
- Click Edit on the FlowPart or BagPart
- Set the Editor field to
Blocks
Or programmatically using a migration:
_contentDefinitionManager.AlterTypeDefinition("MyContentType", type => type
.WithPart("BagPart", part => part
.WithEditor("Blocks")
)
);