# Champs disponibles

Que ce soit dans la section config ou repeater les champs utilisés restent les mêmes. Voici un exemple d'utilisation

# Text

'title' => [
    'type' => 'text', // type of field
    'label' => 'Title', // label to display
    'default' => 'Customer reviews' // default value 
]
Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
default Valeur par défault (type: String)

# Color

Afficher un colorpicker avec choix de couleur et / ou un champs pour mettre une couleur custom.

'color' => [
    'type' => 'color', // type of field
    'label' => 'Background color', // label to display
    'default' => '#121212' // default value 
]
Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
default Valeur par défault (type: String (color en héxadecimal))

# Textarea

'description' => [
    'type' => 'textarea', // type of field
    'label' => 'Title', // label to display
    'default' => 'Customer reviews' // default value 
]
Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
default Valeur par défault (type: String)

# Fileupload

'upload' => [
    'type' => 'fileupload', // type of field
    'label' => 'File upload', // label to display
    'path' => '$/cz_gallery/imgs/', // path to upload
    'default' => [ // default value
        ['url' => 'https://via.placeholder.com/100x100'],
    ],
]
Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
path Chemin d'upload du fichier, Doit absolument commencer par $
$ équivaut à _PS_ROOT_DIR_
pour un chemin custom d'un module: $/modules/module_name/views/images/
default Image par défaut (type: Array)

# Selector

Selector Vous permettra de créer un champs de recherche en fonction d'une PrestaShopCollection ou ObjectModel

Return ObjectPresenter

Exemple pour rechercher un produit:

'product' => [
    'type' => 'selector', // type of field
    'label' => 'Choose a product', // label to display
    'collection' => 'Product', // Collection to cearch
    'default' => 'default value', // default value
    'selector' => '{id} - {name}' // will be replaced by Object Attribute and will be used for search results
]

Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
collection PrestaShopCollection ou ObjectModel
ex: Product / Category / CMS (fonctionne avec tous les objects model)
default value par defaut (type: Array)

# Editor

Editor Vous permettra de créer un champs de type TinyMce

'text' => [
    'type' => 'editor', // type of field
    'label' => 'Editor', // label to display
    'default' => '<p>Hello <strong>World</strong> !' // default HTML value
]

Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
default Valeur par défault (type: String)

# Checkbox

checkbox Vous permettra de créer un champs de type <input type='checkbox'> Idéal pour certaines configurations.

Return Bool

'show' => [
    'type' => 'checkbox', // type of field
    'label' => 'Use custom image', // label to display
    'default' => false // default value (Boolean)
]

Options Description
type Type du champs text / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
default Valeur par défault (type: Boolean)

Default: false

# Radio Group

radio_group Vous permettra de créer un choix sous forme de <input type='radio'>

Return String

'radio_group' => [
    'type' => 'radio_group', // type of field
    'label' => 'Choose a value',  // label to display
    'default' => '3', // default value (String)
    'choices' => [
        '1' => 'Radio 1',
        '2' => 'Radio 2',
        '3' => 'Radio 3',
    ]
],

Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
choices Option possibles format: ['id' => 'value']
default Valeur par défault (type: String)

# Select

select Vous permettra de créer un choix sous forme de <select></select>

Return String

'choices' => [
    'type' => 'select', // type of field
    'label' => 'Choose a value', // label to display
    'default' => '3', // default value (String)
    'choices' => [
        '1' => 'Radio 1',
        '2' => 'Radio 2',
        '3' => 'Radio 3',
    ]
],

Options Description
type Type du champs text / color / textarea / fileupload / selector / editor / checkbox / radio_group / select
label Label à afficher
choices Options possibles format: ['id' => 'value']
default Valeur par défault (type: String)