Mar 8, 2018 11:54:49 AM seb leridon avatar   914

Create site properties

Objective

The purpose of this feature is that a plugin can provide properties to populate that are automatically added to the site's property management interface. For example, the gtools plugin (Google Tools) offers Google Analytics code entry in the site properties.

Operation

The keys of the properties are stored in the Datastore . By convention, they must be prefixed by the name of the plugin followed by site_property .

For a property group to appear in the back office interface "Site Properties Management", you must declare a bean in the context file of the plugin.

This bean must provide the following information:

  • Name of the group
  • group description
  • prefix group keys

Here is the example statement of the bean (replace XXX by the name of the plugin):

<bean id="XXX.sitePropertiesGroup" class="fr.paris.lutece.portal.service.site.properties.SitePropertiesGroup" >
        <property name="nameKey"><value>XXX.site_properties.name</value></property>
        <property name="descriptionKey"><value>XXX.site_properties.description</value></property>
        <property name="keysPrefix"><value>XXX.site_property.</value></property>
</bean>

NB: The keys of the name and description of the group are i18n keys to be created in the myplugin_messages_(locale).properties file. The properties themselves must be created in the Datastore , either by an initialization sql script or by API.

Similarly, the label (label) and help text of a property must be entered in the i18n resource file (s), following the rules below:

  • The i18n key of the label must have the same name as the key of the property in the datastore
  • The i18n key of the help text is the key of the label suffixed by ". Help ".

By default the properties are editable in a single-line text field. If the key of the property ends with ".textblock", the property of the site will be editable in a multiline field (text area). If the property key ends with ".htmlblock", the site property will be editable in a rich text editor.

Here is an example of myplugin_messages_en.properties

site_properties.name = My plugin \'s properties
site_properties.description = Specific editable properties of my plugin
site_property.myproperty1 = My property 1
site_property.myproperty1.help = Help text for my property 1
site_property.myproperty2.textbloc = My property 2
site_property.myproperty2.textbloc.help = Help text for my property 2
...