PiranhaCMS / piranha.core

Piranha CMS is the friendly editor-focused CMS for .NET that can be used both as an integrated CMS or as a headless API.
http://piranhacms.org
MIT License
2k stars 559 forks source link

Add manager hooks for altering view models #1767

Open ddavisfw opened 2 years ago

ddavisfw commented 2 years ago

We have custom page types that generate over 1,000 individual pages for this page type. Essentially each page is "booth" for a vendor. We customized the project to hide these page types from the page list so it doesn't clutter everything for the content editors. It would be nice if this was done by default in Piranha where even custom page types could be always hidden from the page list or a filter could be applied.

tidyui commented 2 years ago

In the old version of Piranha we had hooks for when each of the models where loaded in the manager, this way you could modify the data before it was sent to the view. Not sure how performant this solution would be in your specific case, it seems unnecessary to load and create 1000 objects just to throw them away afterwards.

ddavisfw commented 2 years ago

The pages still exist and contain meta data for each booth. The pages don't get thrown away, they just are in a state of not being touched manually. This is necessary for azure search to work as well. Without a page, there is no search feature.

tidyui commented 2 years ago

I didn’t mean throw away as in deleting them 🙂 I meant first creating a huge view model for the manager and then filtering out 1000 pages. The most performant solution would of course be to filter when loading the sitemap