ideas
ideas copied to clipboard
Limit some blueprints to one entry per collection
I'd love to see a "singleton" mode for collection blueprints: hide the blueprint only if it is already in use in the collection, effectively only ever allowing a single entry of a blueprint per collection.
Example use case: a "pages" collection with the blueprints "page", "newsletter" and "contact". There can be however many "page"s needed, but there should only ever be a single newsletter or contact page as they have special meaning in the system. Crucially, unpublishing (or deleting) the newsletter page is used as a flag for hiding any newsletter functionality across the site.
There's a workaround: Create all entries of those blueprints, then hide the blueprints. The biggest flaw: when an editor deletes an entry with a hidden blueprint, they can no longer re-create an entry of that blueprint, as the dropdown hides the blueprint. Another issue is that hiding all but one blueprint will no longer show the blueprint title next to the page title in collection listings.
I like it!On Aug 6, 2024, at 1:40 PM, Philipp Daun @.***> wrote: I'd love to see a "singleton" mode for collection blueprints: hide the blueprint only if it is already in use in the collection, effectively only ever allowing a single entry of a blueprint per collection. Example use case: a "pages" collection with the blueprints "page", "newsletter" and "contact". There can be however many "page"s needed, but there should only ever be a single newsletter or contact page as they have special meaning in the system. Crucially, unpublishing (or deleting) the newsletter page is used as a flag for hiding any newsletter functionality across the site. There's a workaround: Create all entries of those blueprints, then hide the blueprints. The biggest flaw: when an editor deletes an entry with a hidden blueprint, they can no longer re-create an entry of that blueprint, as the dropdown hides the blueprint. Another issue is that hiding all but one blueprint will no longer show the blueprint title next to the page title in collection listing. Screenshot.2024-08-06.at.19.35.58.png (view on web)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Interesting idea! Maybe this could be changed to setting a number of max. entries using this blueprint instead of just fixing it to one entry?
Coming from Wagtail I see that they do it with properties like max_count and max_count_per_parent
Reference:
max_count
max_count_per_parent
@daun we are experiencing the same problem. May I ask which workflow you are using in the meantime to overcome this?
@tognee I haven't heard of Wagtail, but the max_count seems useful. I have used Craft CMS in the past, which allows you to define whatever a collection (they call it sections) is a single, a structure or a channel: https://craftcms.com/docs/5.x/reference/element-types/entries.html#section-types.
@jerome2710 We currently leave the blueprints available and instruct editors to take extra care. So no workflow really. We’ve been thinking about manually validating/throwing in an EntryCreating event but haven’t yet come around to experimenting with that.