statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
32 stars 1 forks source link

Limit some blueprints to one entry per collection #1204

Open daun opened 3 months ago

daun commented 3 months ago

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.

Screenshot 2024-08-06 at 19 35 58
jackmcdade commented 3 months ago

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: @.***>

morhi commented 3 months ago

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?