The declaration of a parameter may differ slightly depending on the use case (metadata, configuration parameter, service parameter, etc.). Go to the parameter page corresponding to your use case to find out the exact declaration.
Wording and description
Every parameter has a label and a description. The description is used as an input aid.
The label and description can be keyed i18n (internationalization) or not. Use the i18n attribute to internationalize or not the parameter.
Ex: Internationalized label and description
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The type of a parameter defines its storage format.
7 types are supported, listed below.
Type
Description
string
Simple text
long
Whole number
double
Decimal number
date
Date
binary
Binary file
boolean
Boolean value (true or false)
password
Password
For example, for content type metadata, the "rich-text" type for rich fields and the "composite" type are also supported. Go to the parameter page corresponding to your use case for the exact list of supported types.
Enumerations
The possible values for a parameter can be restricted to a list of values = enumeration. In this case, the value is selected from a drop-down list.
To define an enumeration, use the <enumeration>.
Static enumeration
The list of values for a static enumeration is declared directly in the parameter declaration.
Static enumeration declaration: 4 possible values
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Le tag <validation> permet de définir des règles de validation sur le paramètre
<mandatory> to make the parameter mandatory
<regexp> to define a regular expression
<invalidText> to personalize the message in the event of incorrect input (regular expression not respected)
<custom-validator> java class implementing the org.ametys.runtime.util.parameter.Validator to define your own validator
For example org.ametys.runtime.plugins.core.util.parameter.TextValidator or org.ametys.runtime.plugins.core.util.parameter.RichTextValidator support a sub-tag
<maxlength> for a maximum number of supported characters
Here are a few examples.
Validation of a mandatory " mail address" field
Declaration
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The validator RichTextValidator accepts parameters <mandatory>, <regexp>, <invalidText> and <maxlength> for the maximum number of characters allowed.
In editing mode, if the maximum number of characters is exceeded, the character counter turns red. It will not be possible to validate the form until the number of characters has been respected.
Editing widgets
A parameter can use a "widget"for modification. A widget is an advanced form field, used as an input aid.
For example,
a "string" parameter can use widget "textarea" to edit the parameter on several lines.
an enumeration can use the widget "sorted-multiselect" to allow multiple selection where values are sorted alphabetically.
The widget tag is used for this purpose. <widget> :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
By default, each type (string, data, long, ...) has its own widget (e.g. a calendar for date).
Go to the parameter page corresponding to your use case for the exact list of supported widgets.
Here is the list of widgets used by default for each type of parameter
Type
Widget
Rendering
string
Text field or drop-down list for enumerations
date
Calendar
long
Text field accepting integers only
double
Text field accepting only integers or decimal numbers
boolean
Check box
password
Double field for password confirmation
binary
File" field for selecting a file on the disk
Default values
A parameter can have a default value.
In the case of multiple parameters, it is possible to enter several default values (see complex case).
If the parameter defines an enumeration, the default values must be among those proposed by the enumeration. For example, in the complex case, the enumeration proposes the 4 values fr, en, es and de; the default values are fr and en.
Example:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
The default values of a parameter can also take the value of a configuration parameter. To do this, enter the "config" type and the configuration parameter identifier. The parameter type must correspond to the type of configuration parameter used.
Example with the value of a configuration parameter :
Oops!
Copy to clipboard failed. Open the code and copy it manually.