[Solved] What is the correct syntax in viewlets.zcml for a template path outside curreent project?

What is the correct syntax for the template attribute in a Viewlet or Page Directive? I subclassing the Viewlet:

<!-- Override Content Lead Image Viewlet -->
<browser:viewlet
  name="contentleadimage"
  for="plone.app.contenttypes.behaviors.leadimage.ILeadImage"
  layer="my.addon.interfaces.IMyAddonLayer"
  view="plone.app.layout.globals.interfaces.IViewView"
  class=".viewlets.LeadImageViewlet"
  manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle"
  permission="zope2.View" />

if i remove the template attribute then i got an error:

NotImplementedError: `index` method must be implemented by subclass.

I would like use the original template. i could copy it to my project and use it via

template="template/leadimage.pt"

I have checked this:

template="..plone/app/contenttypes/behaviors/leadimage.pt"

or this

template="/plone/app/contenttypes/behaviors/leadimage.pt"

with no success.

but i thought i can reuse it from the original location.

Update

<!-- Override Content Lead Image Viewlet,
     only the Class, not the Template,
     no copy of template to the own package is needed -->
<configure package="plone.app.contenttypes">
  <browser:viewlet
    name="contentleadimage"
    for="plone.app.contenttypes.behaviors.leadimage.ILeadImage"
    layer="my.addon.interfaces.IMyAddonLayer"
    view="plone.app.layout.globals.interfaces.IViewView"
    class="my.addon.browser.viewlets.LeadImageViewlet"
    manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle"
    template="behaviors/leadimage.pt"
    permission="zope2.View" />
</configure>

https://docs.plone.org/4/en/develop/addons/components/zcml.html#specify-files-and-code-from-another-package

3 Likes

Thanks! That's what i searched and needed.