Hi all
I am developing a custom content-type that should have some user-selectable
views
(as in "atct_album_view" and so on) available in the standard "Display"
Plone menu.
I just spent some hours to figure out why they didn't appear in the menu.
The fact was that they were browser views (so @@view1 and @@view2).
I solved it aliasing my views to strip the @@ part.
In profiles/default/types/mytype.xml:
 <property name="view_methods">
  <element value="view1"/>
  <element value="view2"/>
 </property>
 <alias from="@@view1" to="view1"/>
 <alias from="@@view2" to="view2"/>
I don't know if this is supposed to be the right way as I couldn't fully
understand the code from method getAvailableLayouts of
CMFDynamicViewFTI.browserdefault.BrowserDefaultMixin
Should I register two adapters with name="@@view1" and name="@@view2"?
If so, can someone tell me the exact syntax?

Thanx

    SIlvio

here is the code from CMFDynamicViewFTI.browserdefault.BrowserDefaultMixin:
def getAvailableLayouts(self):
    ...
    method_ids = fti.getAvailableViewMethods(self)
    for mid in method_ids:
         view = zope.component.queryMultiAdapter((self, self.REQUEST),
                                                 zope.interface.Interface,
                                                 name=mid)
        if view is not None:
            menu = zope.component.getUtility(
                IBrowserMenu, 'plone_displayviews')
            item = menu.getMenuItemByAction(self, self.REQUEST, mid)
            ... # add the view to the available ones
        method = getattr(self, mid, None)
        if method is not None:
            ... # add the view to the available ones
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to