-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix plone 5 compatibility for site controlpanel customization
- Loading branch information
Showing
4 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from zope.formlib.form import FormFields | ||
from plone.app.controlpanel.site import ISiteSchema | ||
from plone.app.controlpanel.site import SiteControlPanel as BaseSiteControlPanel | ||
from z3c.form.interfaces import HIDDEN_MODE | ||
from Products.CMFPlone.controlpanel.browser.site import SiteControlPanel as BaseSiteControlPanel # noqa | ||
from Products.CMFPlone.controlpanel.browser.site import SiteControlPanelForm as BaseSiteControlPanelForm # noqa | ||
|
||
|
||
class SiteControlPanelForm(BaseSiteControlPanelForm): | ||
|
||
def updateWidgets(self): | ||
super(SiteControlPanelForm, self).updateWidgets() | ||
# Hide the basic webstats_js field | ||
self.widgets['webstats_js'].mode = HIDDEN_MODE | ||
|
||
|
||
class SiteControlPanel(BaseSiteControlPanel): | ||
""" | ||
Hide the basic webstats_js field | ||
""" | ||
|
||
form_fields = FormFields(ISiteSchema).omit('webstats_js') | ||
|
||
form = SiteControlPanelForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from zope.formlib.form import FormFields | ||
from plone.app.controlpanel.site import ISiteSchema | ||
from plone.app.controlpanel.site import SiteControlPanel as BaseSiteControlPanel | ||
|
||
|
||
class SiteControlPanel(BaseSiteControlPanel): | ||
""" | ||
Hide the basic webstats_js field | ||
""" | ||
|
||
form_fields = FormFields(ISiteSchema).omit('webstats_js') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters