Is there a simple way to register a viewlet (just) for TTW types.
I assume I could make a behavior (and register it for that), but would prefer if there was another (more direct) way.
Is there a simple way to register a viewlet (just) for TTW types.
I assume I could make a behavior (and register it for that), but would prefer if there was another (more direct) way.
https://docs.plone.org/external/plone.app.dexterity/docs/model-driven-types.html
maybe using
<property name="schema">example.conference.presenter.IPresenter</property>
``` ?
there is way - take a look at the docs:
https://docs.plone.org/develop/plone/views/viewlets.html#rendering-viewlet-by-name
(attn: viewlet = factory(context, request, self, None).__of__(context)
will not work in plone 5.2 any more -> remove __of__(context)
)
you need to render the viewlets as browser pages. these pages can be used for any other purpose also for views of ct-types. e.g. '@@viewlets/<viewlet.name>' or simple add the viewlets in your code with
<div tal:content="context/@@viewlets/<viewlet.name>"/>
<browser:page
name="viewlets"
for="*"
permission="zope.Public"
class=".viewlets.Viewlets"
allowed_interface="<your tools interface>"
layer="<your theme layer>"
/>
this would be a dynamic solution.
Thanks