-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Block Content Type Picker for FlowPart and BagPart #18625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…endered more than once
…rchardCore into buzznick/block_picker
…and category from appsettings
Removed the if statetment from the _contentDefinitionManager.AlterTypeDefinitionAsync as is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a modern block-style content type picker for FlowPart and BagPart editors, replacing the traditional dropdown-based widget selector with a Vue.js-powered modal featuring visual thumbnails, category filtering, and search capabilities.
Key Changes:
- Adds new block editor alternatives for FlowPart and BagPart with visual content type picker
- Introduces Category and ThumbnailPath settings to ContentTypeSettings for improved organization
- Implements shared Vue.js modal component for consistent picker experience across editors
Reviewed changes
Copilot reviewed 31 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
OrchardCore.Flows.Core/Models/BagPartBlocksEditorSettings.cs |
New settings model for customizing BagPart blocks editor |
OrchardCore.ContentTypes.Abstractions/ContentTypesOptions.cs |
Configuration options for default thumbnail and category |
OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentTypeSettings.cs |
Added Category and ThumbnailPath properties |
OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentTypeSettingsExtensions.cs |
Extension methods for new settings |
OrchardCore.ContentManagement.Abstractions/Metadata/Models/ContentTypeDefinitionDriverOptions.cs |
Added Categories property for UI options |
OrchardCore.Flows/wwwroot/Scripts/content-type-picker.js |
Vue.js application for content type picker modal |
OrchardCore.Flows/Views/FlowPart-Blocks.Edit.cshtml |
Block editor view for FlowPart |
OrchardCore.Flows/Views/BagPart-Blocks.Edit.cshtml |
Block editor view for BagPart |
OrchardCore.Flows/Views/ContentTypePicker.cshtml |
Shared Vue.js picker component |
OrchardCore.Flows/Views/ContentCard-FlowPartBlocks.Edit.cshtml |
Content card template for FlowPart blocks |
OrchardCore.Flows/Views/BagPartBlocksEditorSettings.Edit.cshtml |
Settings editor for BagPart blocks |
OrchardCore.Flows/ViewModels/BagPartEditViewModel.cs |
Added properties for button and modal text customization |
OrchardCore.Flows/Settings/BagPartBlocksEditorSettingsDriver.cs |
Display driver for BagPart blocks settings |
OrchardCore.Flows/Extensions/ContentTypePickerExtensions.cs |
Helper extensions for retrieving category and thumbnail |
OrchardCore.Flows/Drivers/BagPartDisplayDriver.cs |
Updated to pass blocks settings to view model |
OrchardCore.Flows/Controllers/AdminController.cs |
Added cardCollectionType parameter support |
OrchardCore.Flows/ResourceManifest.cs |
Registered content-type-picker script resource |
OrchardCore.Flows/Startup.cs |
Registered BagPartBlocksEditorSettingsDriver |
OrchardCore.ContentTypes/Views/ContentTypeSettings.Edit.cshtml |
UI for Category and ThumbnailPath settings |
OrchardCore.ContentTypes/ViewModels/ContentTypeSettingsViewModel.cs |
Added Category and ThumbnailPath properties |
OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs |
Display driver updates for new settings |
OrchardCore.ContentTypes/Services/ContentDefinitionService.cs |
Applied default thumbnail and category to new content types |
OrchardCore.ContentTypes/Startup.cs |
Configuration for ContentTypesOptions |
OrchardCore.ContentTypes/wwwroot/placeholder.png |
Default placeholder image |
appsettings.json |
Example configuration for ContentTypes options |
launchSettings.json |
Minor formatting change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/OrchardCore.Modules/OrchardCore.Flows/Views/FlowPart-Blocks.Edit.cshtml
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart-Blocks.Edit.cshtml
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Flows/Assets/js/content-type-picker.js
Outdated
Show resolved
Hide resolved
Added error handling to the content type picker so it shows an error message at the top of the modal if the buildeditor request fails. Improves UX as user does not need to reopen the modal to try again.
barthamark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn’t it be useful to add some documentation to the Orchard Core docs?
Sure, will update the docs and update PR shortly. |
- Add blocks editor section to Flow/README.md explaining how to enable the modal-based content type picker - Add blocks editor documentation to BagPart.md with BagPart-specific settings (Add Button Text, Modal Title Text) - Add Content Type Settings for Block Pickers section to ContentTypes README covering category, thumbnail, and ContentTypesOptions defaults
|
@barthamark I have just pushed up changes to the documention for the FlowPart, BagPart and Content Types. |
| { | ||
| "OrchardCore": { | ||
| "OrchardCore_ContentTypes": { | ||
| "DefaultCategory": "Widgets", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the actual default category? Is it Content or empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default it is an empty string, but can be configured in the app settings if a default is wanted.
|
Hi everyone, was there any changes needed to get this PR merged? We discussed maybe moving the defaults to a custom setting that could be set in the Admin UI but wasnt sure if that was the general consensus. |
|
@buzznick let me have a look at the great work that you did, then review your PR if it's possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work, I like it 🤗
I'm not sure if you can put more effort into it, but I think we should try to avoid using Vue 2 and jQuery for new features.
|
@gvkries thanks for feedback. Will update to Vue 3 and remove jQuery dependency. 👍 |
|
This pull request has merge conflicts. Please resolve those before requesting a review. |
|
@buzznick any news here by chance? |
|
@Piedone removing the jQuery dependency is fine, was having issues upgrading to Vue3 as other editors (mainly the media gallery) on the page used Vue 2 I was getting a mismatch of versions and cuasing errors. Is there a plan to upgrade all Vue 2 instances to Vue 3? |
|
@Piedone thanks, I did see the other attempts. As it is a big task, suggest sticking with Vue 2 for now. I can remove the jQuery dependancy and sort out the conflicts shortly. |
|
OK, thanks! |
|
I agree, let's stick with Vue 2 for now. Thanks @buzznick |
Summary
This PR introduces a new block-style editor for FlowPart and BagPart that provides a modern, visual content type picker with thumbnail previews, category filtering, and search functionality. This enhances the content editing experience by allowing editors to browse and select content types in a more intuitive way.
Motivation
The existing dropdown-based widget selector can become unwieldy when sites have many content types available as widgets. This new block picker provides:
Features
New Block-Style Editor
Content Type Picker Modal
Content Type Settings Enhancements
Added new settings to
ContentTypeSettings:These settings are editable in the Content Types admin UI.
Configurable Defaults
Added
ContentTypesOptionsfor site-wide configuration viaappsettings.json:{ "OrchardCore": { "OrchardCore_ContentTypes": { "DefaultThumbnailPath": "~/OrchardCore.ContentTypes/placeholder.png", "DefaultCategory": "Content" } } }BagPart Editor Settings
Added
BagPartBlocksEditorSettingsto customise:Files Changed
New Files
OrchardCore.Flows/Assets/js/contentTypePicker.jsOrchardCore.Flows/Views/ContentTypePicker.cshtmlOrchardCore.Flows/Views/FlowPart-Blocks.Edit.cshtmlOrchardCore.Flows/Views/BagPart-Blocks.Edit.cshtmlOrchardCore.Flows/Views/ContentCard-FlowPartBlocks.Edit.cshtmlOrchardCore.Flows/Extensions/ContentTypePickerExtensions.csOrchardCore.Flows/Settings/BagPartBlocksEditorSettingsDriver.csOrchardCore.Flows.Core/Models/BagPartBlocksEditorSettings.csOrchardCore.ContentTypes/wwwroot/placeholder.pngOrchardCore.ContentTypes.Abstractions/ContentTypesOptions.csModified Files
OrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentTypeSettings.csOrchardCore.ContentManagement.Abstractions/Metadata/Settings/ContentTypeSettingsExtensions.csOrchardCore.ContentTypes/Services/ContentDefinitionService.csOrchardCore.ContentTypes/Startup.csOrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.csOrchardCore.ContentTypes/Views/ContentTypeSettings.Edit.cshtmlOrchardCore.Flows/Startup.csOrchardCore.Flows/ResourceManifest.csOrchardCore.Flows/Controllers/AdminController.csOrchardCore.Flows/Drivers/BagPartDisplayDriver.csScreenshots
New Content Type Picker
Content Picker Options
Customise the add button and modal title for the BagPart editor.

Optional Content Type Category and Thumbnail
Testing
Breaking Changes
None. The existing dropdown editors remain the default. The new block editors are opt-in via part settings. The new Content Type settings (Category and Thumbnail) are optional, existing content types will be empty.
Migration Notes