Dynamic views that are @@views don't show in the Display menu
Silvio
silviot at gmail.com
Thu Sep 20 01:50:31 UTC 2007
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20070920/aa3de60f/attachment.html>
More information about the Product-Developers
mailing list