3

I already know how to programatically set the default view content, in my specific case, a Folder, or how to use the Plone UI to do it. In my case, I am creating a large skeleton of content via GenericSetup and I need a set of folders to have a specific content item in each folder be the default view.

So, I have a folder structure like so:

folder1/
-- .properties
-- page1
-- homepage1
folder2/
-- .properties
-- page2
-- homepage2

I would think that in:

profile/default/structure/folder1/.properties 

you would be able to add:

DefaultView = homepage1

or similar. So the question is: "Is it possible to set the default view of a content item using Generic Setup?"

This answer might also work; I haven't tried it yet because I'd like some feedback on my question before moving away from GS to using ZCML.

How to define default views in Plone

Community
  • 1
  • 1
Spanky
  • 5,608
  • 10
  • 39
  • 45

1 Answers1

2

The GS structure importer doesn't support this; it has no idea about the (Plone specific) Dynamic Layout support.

You'll have to write your own custom GS step to do this, I am afraid, or perhaps use something like plone.app.transmogrifier (it includes support for browser defaults and collective.transmogrifier includes a GS step) to configure this.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • ok thank you, I'll add it to my list of "features to add someday" ;-) – Spanky Feb 22 '12 at 20:53
  • 1
    Get some inspiration from Products.CMFPlone, look for the setLayout() method: https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/setuphandlers.py#L264 – Davi Lima Feb 24 '12 at 02:23