This package provides viewlet to embed social button to Plone site. The viewlet can be assigned to wherever viewlet managers through the web. Since restrictions for the embedded code are not set, you need to be cautious about the security risk with the embedding code.
Once the package is installed through Site Setup Add-ons, there appears Social Button Code Setting and Social Button Configuration links within the Add-on Configuration section.
To start the configuration, go to Social Button Code Setting first to set the embedding code.
Once Social Button Code Setting is set, you can go to Social Button Configuration for the farther configuration.
Example to set values from file system code:
registry = getUtility(IRegistry)
registry['hexagonit.socialbutton.config'] = {
u'facebook': {
u'content_types': u'Page,News Item',
u'viewlet_manager': u'plone.abovecontent\nplone.belowcontent',
u'view_models': u'*',
u'view_permission_only': 'True',
u'enabled': 'True',
}
}
Example to register through registry.xml:
<record name="hexagonit.socialbutton.config">
<field type="plone.registry.field.Dict">
<title>Configuration for Social Buttons</title>
<key_type type="plone.registry.field.TextLine" />
<value_type type="plone.registry.field.Dict">
<title>Value list</title>
<key_type type="plone.registry.field.TextLine" />
<value_type type="plone.registry.field.Text">
<title>Values</title>
</value_type>
</value_type>
</field>
<value>
<element key="facebook">
<element key="content_types">Page,News Item</element>
<element key="viewlet_manager">plone.abovecontent
plone.belowcontent</element>
<element key="view_models">*</element>
<element key="view_permission_only">True</element>
<element key="enabled">True</element>
</element>
</value>
</record>
Country mapping against language resides in hexagonit.socialbutton.config module.
LANGUAGE_COUNTRY = {
'en': 'US',
'fi': 'FI',
'ja': 'JP',
'ru': 'RU',
'sv': 'SE',
}
The locales are constructed with hexagonit.socialbutton.adapter.dollar.LangCountry adapter.
from plone.stringinterp.interfaces import IStringSubstitution
from zope.component import getAdapter
getAdapter(self.context, IStringSubstitution, name="lang_country")()
Contents:
Social Button Code Setting¶
Example to set values from file system code:
Example to register through registry.xml: