Plone 5 custom content types missing in portal navigation - dexterity

When adding dexterity content types to my Plone 5.3 instance, they do not show up in the portal navigation.
I tried ttw and with a custom product.
The catalog is up-to-date. I forced rebuilding with no success.
The behaviors added to the type are:
<property name="behaviors">
<element value="plone.dublincore"/>
<element value="plone.namefromtitle"/>
<element value="plone.allowdiscussion"/>
<element value="plone.excludefromnavigation"/>
<element value="plone.shortname"/>
<element value="plone.constraintypes"/>
<element value="plone.relateditems"/>
<element value="plone.nextprevioustoggle"/>
</property>
How can I make the custom types show up in the portal navigation?

Layer 8 error.
After fiddling around with other settings, I remembered that this is actually an option. Under <PORTAL_URL>/##navigation-controlpanel, one can select the content types that appear in the portal navigation.

Related

Plone 4: Customize News Item as folder

How can I customize News Item content type to behave like a folder (accept files, folders as children)?
/portal_types/News%20Item/manage_propertiesForm
Changing Allowed content types seems to have no effect.
Try searching for collective.folderishtypes, that provides "Folderish News Item". Then look for 'folderish' at http://docs.plone.org for further reading. At this moment, using Dexterity to customize content types is better for future upgrades.

How to allow comments on a PloneFormGen folder?

Is there any way to allow users to comment (i.e., have a discussion) on a ploneformgen folder? I have allowed comments for Form Folders under Type Settings, and checked "Allow comments" under the edit>settings tab of the particular Form Folder, but this doesn't work, which is weird, because this is exactly what I do to allow comments on Pages, etc. Any ideas?
I fear that PFG is not including Plone viewlets by its own.
You must probably customize the Form view and enabling the proper viewlet manager.
If you look at the plone.app.discussion source at https://github.com/plone/plone.app.discussion/blob/9a4e3718fc8ae7e6f8f229058a27092b0d121a84/plone/app/discussion/browser/configure.zcml#L108 you'll see that the comment viewlets is defined in the plone.app.layout.viewlets.interfaces.IBelowContent manager.
So you must re-enable this manager in your customized template, this can be enough:
<div tal:replace="structure provider:plone.belowcontentbody" />
Put this after the main content. As side effects, other viewlet in this new manager can be displayed, in that case use CSS to hide them.

How can I add a Dexterity content type as the default view?

I'm trying to set a folder default view as a Dexterity content type that I created. But I see that Dexterity content types aren't in the list of possible default content views for folders. Why? Is there an option that I must set in the content type?
Content items are listed as candidate default pages if:
the object is not a container type
or
the object portal type is listed in the default_page_types of your site_properties property sheet. Find that in the ZMI (site settings -> Zope Management Interface -> portal_properties).
The default_page_types property is a list of portal_type ids; for Dexterity types that is usually a dotted name (the Dexterity manual uses example.conference.presenter for example).
Update for Plone 5.x
Go to Site Setup > Content Settings control panel
Select your (dexteity-)contenttype in the Workflow, visibility and versioning settings for your content types dropdown.
check Can be used as a default page
(default_page_types property has been removed from ZMI)

Prevent certain types from appearing in folder listings in plone.app.theming

I have a site which has a public url displayed through a plone.app.theming / Diazo theme and url restricted to content editors displayed through sunburst.
I'd like certain portal types to only appear in listings to the cms editors and not on the public site. I notice that the folder_listing template uses request/contentFilter if defined. Is there some way to add a content filter to the request just for the themed view?
I ended up solving this using a pre traversal hook on the Plone site. This worked in my case because I can reliably work out whether a request is for the theme view or editing view based on some properties of the request.
def SetupThemeView(site, before_traverse):
""" If we're serving the public, themed, version then supplement the request
"""
request = before_traverse.request
if serving_theme_view(request):
request.set('contentFilter', {'portal_type' : listable_types})
Where serving_theme_view determines if we're serving the theme or editor view and listable_types is a tuple of type names of types we want to appear in listings in the theme view.
I then register this as a subcriber in my configure.zcml
<subscriber
for="Products.CMFCore.interfaces.ISiteRoot
zope.traversing.interfaces.IBeforeTraverseEvent"
handler=".events.SetupThemeView"
/>

Can a Plone viewlet be made to appear on one page or folder only?

Plone's viewlets appear to be site-wide by default. How can I make a viewlet only appear on a certain page?
This is done with Theme Interface in Plone. Check this documentation:
http://plone.org/documentation/manual/theme-reference/buildingblocks/components/themespecific
If u created your Theme / viewlet with a paster template, all should be in place and ready to use.
In addition to theme-specific viewlets, mentioned by #user276028, you can create browserlayers for non-theme viewlets:
Example taken from collective.atimage.transformtoolbar:
Create a browserlayer (you can create them with paster localcommand addcontent browserlayer):
Add an interface for the layer.
Create a browserlayer.xml file GenericSetup to register it as a layer.
Use the layer in viewlet registration:
Edit your viewlet registration in configure.zcml with a layer attribute pointing to your interface.
In the configure.zcml linked file you can also see how to show the viewlet just for some content types (for property) and just for default view of that content type (view property).
Any other case, I think you should decide when to show/hide your viewlet code or template, like in the available method.

Resources