def _initSite(self, with_icon=False): from OFS.Folder import Folder from Products.CMFActionIcons.ActionIconsTool import ActionIconsTool self.root.site = Folder(id='site') site = self.root.site tool = ActionIconsTool() site._setObject(tool.getId(), tool) if with_icon: tool.addActionIcon(category=self.CATEGORY, action_id=self.ACTION_ID, title=self.TITLE, priority=self.PRIORITY, icon_expr=self.ICON_EXPR) return site
def _initSite(self, with_icon=False): from OFS.Folder import Folder from Products.CMFActionIcons.ActionIconsTool import ActionIconsTool _setUpDefaultTraversable() self.root.site = Folder(id='site') site = self.root.site tool = ActionIconsTool() site._setObject(tool.getId(), tool) sm = getSiteManager() sm.registerUtility(site.portal_actionicons, IActionIconsTool) if with_icon: tool.addActionIcon(category=self.CATEGORY, action_id=self.ACTION_ID, title=self.TITLE, priority=self.PRIORITY, icon_expr=self.ICON_EXPR) return site
def addActionIcon(self, category, action_id, icon_expr, title=None, priority=0): combination = '%s/%s' % (category, action_id) if combination not in WHITELISTED_AI: log_deprecated("An icon for the '%s' action is being added to " "the action icons tool. The action icons tool has " "been deprecated and will be removed in Plone 5. " "You should register action icons directly on the " "action now, using the 'icon_expr' " "setting." % combination) return BaseTool.addActionIcon(self, category, action_id, icon_expr, title, priority)