Nov 9, 2021 3:55:06 PM Thomas Dumont avatar

Create a site property group

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 as foolows :

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

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
site_property.myproperty3.htmlbloc=My property 3
site_property.myproperty3.htmlbloc.help=Help text for my property 3
...