Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>to prevent the portlet aquisition and maintain the possibility of adding portlert you can add an event listener on the creation of your contents that auto blocks the aquisition.</p> <p>Like this:</p> <pre><code> &lt;subscriber for="my.package.interfaces.IMyContent zope.app.container.interfaces.IObjectAddedEvent" handler=".subscribers.blockPortletsUpponMyContentCreation" /&gt; </code></pre> <p>and than do this:</p> <pre><code>from zope.component import getMultiAdapter, getUtility from plone.portlets.interfaces import IPortletManager from plone.portlets.interfaces import ILocalPortletAssignmentManager from plone.portlets.constants import USER_CATEGORY from plone.portlets.constants import GROUP_CATEGORY from plone.portlets.constants import CONTENT_TYPE_CATEGORY from plone.portlets.constants import CONTEXT_CATEGORY def blockPortletsUpponMyContentCreation(mycontent, event): for manager_name in ('plone.leftcolumn','plone.rightcolumn'): manager = getUtility(IPortletManager, name=manager_name) assignable = getMultiAdapter((mycontent, manager,), ILocalPortletAssignmentManager) for category in (GROUP_CATEGORY, CONTENT_TYPE_CATEGORY,CONTEXT_CATEGORY,USER_CATEGORY): assignable.setBlacklistStatus(category, 1) </code></pre> <p>Note: this code is inspired by the <a href="http://svn.plone.org/svn/plone/plone.app.portlets/trunk/plone/app/portlets/browser/manage.py" rel="noreferrer">plone.app.portlet manage view</a></p> <p>Edit 19/08/2011: included fixes as suggested by @will in my untested code...so now is tested</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload