Rectangle 27 1

plone Linking to a "File type" Dexterity Content Type?


First, you have to designate your file field as the content type's "primary" field. Unfortunately this option doesn't show up in the UI so you have to edit the XML version of the schema (there's a button for this in recent versions of the dexterity control panel). Add xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" as a namespace at the top, and add marshal:primary="true" to the field tag in question.

Ohhh my god!!! A TTW solution..?! This is amazing! Thanks David! 100 points to Gryffindor. I was able to implement everything the way you mention except I added it to the typesUseViewActionInListings and it doesn't go to /view automatically, it still downloads the file. I'm totally okay with this though for now. Thanks David!! :)

Then, find your type in portal_types and change the "Default view method" to @@download. (It usually starts out as view for Dexterity content types.) This should make the item's URL download the file rather than showing the normal view. It knows which field to use because you designated it as primary.

You can still access the normal view by adding /view to the end of the item's URL. If you want Plone to do this when linking to the type from navigation and folder contents (just like it does for built-in images and files), go to portal_properties/site_properties and add the type's id to the typesUseViewActionInListings list.

Note