Closed K15Lmk98 closed 8 years ago
Here is an example:
<?php
array(
'fields' => array(
'contents' => array(
'title' => __( 'Contents', 'textdomain' ),
'type' => 'repeatable',
'repeatable' => array(
'limit' => 3,
'fields' => array(
'effort' => array(
'title' => __( 'Effort', 'textdomain' ),
'type' => 'text',
),
'amount' => array(
'title' => __( 'Amount', 'textdomain' ),
'type' => 'number',
'min' => 0.0,
'step' => 0.01,
),
),
),
),
),
);
In this example, the name of the field is contents
, it is a repeatable and contains two fields inside, effort
(a text input field) and amount
(a number input field, in this case to store a price). The fields can be shown 3 times maximum.
Basically, all important stuff of a field with 'type' => 'repeatable'
goes into an additional key 'repeatable'
(as seen above).
Automatic translation
Thanks Felix Arntz, I ask you for a favor :-) I use a structure like this:
'text_field_required' => array( // ID 'title' => __( 'Text field - obbligatorio -', 'myplugin' ), 'type' => 'text', 'required' => true, ),
Now, following your example I plugged
'fields' => array( 'contents' => array( 'title' => __( 'Contents', 'textdomain' ), 'type' => 'repeatable', 'repeatable' => array( 'limit' => 3, 'fields' => array( 'effort' => array( 'title' => __( 'Effort', 'textdomain' ), 'type' => 'text', ), 'amount' => array( 'title' => __( 'Amount', 'textdomain' ), 'type' => 'number', 'min' => 0.0, 'step' => 0.01, ), ), ), ), ),
But you do not see. Make me an example with this structure? Thanks for your patience, Claudio_
Hello Felixarntz, I solved. Thank you and congratulations for the project. Claudio_
Automatic translation
Hello, please, could you do me a code example with a field 'repeatable'?
Thanks, Claudio_