We have a requirement to have a component (exactly 1) mandatory on a page.
Say, admin user has created a page and then no other user can edit-save that page without one of that component on that page.
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityWe have a requirement to have a component (exactly 1) mandatory on a page.
Say, admin user has created a page and then no other user can edit-save that page without one of that component on that page.
No such out of the box functionality is available and Event system is one of the way to achieve it. You may write a custom event system code to achieve this on Page Save event.
If the component is a mandatory feature of the page, then your template should take care of this. If it's truly mandatory, why make it manageable?
This should simply be a question of invoking RenderComponentPresentation
with the component and template ids as parameters. To make this maintainable, I'd suggest passing the webdav urls of the component and template as parameters to your template building block.
If you need to allow it to be managed, then the correct approach is to use the events system to check for conformance when the page is saved.
In addition to Pankaj's answer, the Tridion GUI is also extensible and it maybe possible to extend the Page View such that based on some criteria (the chosen page template perhaps), a Component Presentation is added.
This may require going deep in to the GUI Extension framework - no mean feat!
Alexander's site is a pretty useful resource - http://tridion.uibeardcore.com/