Comment déclarer des propriétés personnalisées dans Epicraft?

Edit me

You can use the custom properties in Epicraft’s interface to redefine or add some options on a component (widget). Custom properties are working by key/value. Depending on the key of the custom, the value might have different format.

In the end, every widget is define by a JSON with this format:

{
	component: 'MyCustomTextfield',
	option: {
		length: 15,
		placeholder: 'John Rambo'
	}
}

Format

  • Component
    • Can be use to define a custom component. See more on “How can I develop my own components for my project?”.
    • Only mandatory for bulks. When this variable is define on another component (like a textfield), the data will still have the type defined in Epicraft but a bulk will be used for the display.
  • Option
    • Contains a list of elements passed to the component.
    • Can contains array, object… etc (like a JSON)
    • If define without the component, option will be passed to the usual component.

Here are some examples:

epimob.widget

The value associated to this key can differ.

Possibles format:

MyCustomTextfield
{
	component: 'MyCustomTextfield',
	option: {
		length: 15
	}
}

epimob.widget.option

The value associated to this key must be a json.

{
	length: 15
}

epimob.widget.option…

Example:

epimob.widget.option.length, value: 15

epimob.widgets…

Apply all options on every components contains in the widget.

For example, if this custom is applied to a group, all components in the group will receive thoses options.

Example

All following examples will define a widget “MyCustomTextfield” with the same options (length: 15, placeholder: “John Rambo”).

Example 1: full

epimob.widget

{
	component: 'MyCustomTextfield',
	option: {
		length: 15,
		placeholder: 'John Rambo'
	}
}

Example 2

epimob.widget

MyCustomTextfield

epimob.widget.option

{
	length: 15,
	placeholder: 'John Rambo'
}

Example 2: detailed

epimob.widget

MyCustomTextfield

epimob.widget.option.length

15

epimob.widget.option.placeholder

John Rambo