Field to group other fields. Can be nested, used with accordion, sort with drag and drop, limit amount.
Regular repeater without accordion.
array(
'type' => 'group',
'id' => 'group_1_sortable',
'title' => esc_html__( 'Sortable, repetable field multiple', 'plugin-name' ),
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => esc_html__( 'Add new', 'plugin-name' ),
'group_title' => esc_html__( 'Accordion Title', 'plugin-name' ),
'limit' => 50,
'sortable' => true,
'mode' => 'compact',
),
'fields' => array(
array(
'id' => 'group_1_sortable_text_1',
'type' => 'text',
'attributes' => array(
// mark this field az title, on type this will change group item title
'data-title' => 'title',
'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
),
),
array(
'id' => 'group_1_sortable_text_2',
'type' => 'text',
'attributes' => array(
// mark this field az title, on type this will change group item title
'data-title' => 'title',
'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
),
),
),
),
Nested group as repeater with accordion.
array(
'type' => 'group',
'id' => 'group_1',
'title' => esc_html__( 'Group field nested (3 level)', 'plugin-name' ),
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => esc_html__( 'Add new (L1)', 'plugin-name' ),
'group_title' => esc_html__( 'Accordion Title', 'plugin-name' ),
'limit' => 50,
'sortable' => true,
),
'fields' => array(
array(
'id' => 'group_1_text_1',
'type' => 'text',
'title' => esc_html__( 'Text', 'plugin-name' ),
'attributes' => array(
// mark this field az title, on type this will change group item title
'data-title' => 'title',
'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
),
),
// Second level
array(
'type' => 'group',
'id' => 'group_1_group_1',
'title' => esc_html__( 'Group field', 'plugin-name' ),
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => esc_html__( 'Add new (L2)', 'plugin-name' ),
'group_title' => esc_html__( 'Accordion Title', 'plugin-name' ),
'limit' => 50,
'sortable' => true,
),
'fields' => array(
array(
'id' => 'group_1_group_1_text_1',
'type' => 'text',
// 'title' => esc_html__( 'Text', 'plugin-name' ),
'attributes' => array(
// mark this field az title, on type this will change group item title
'data-title' => 'title',
'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
),
),
array(
'id' => 'group_1_group_1_color_2',
'type' => 'color',
'title' => 'Color Minicolor',
),
// Third level
array(
'type' => 'group',
'id' => 'group_1_group_1_group_1',
// 'title' => esc_html__( 'Group field', 'plugin-name' ),
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => esc_html__( 'Add new (L3)', 'plugin-name' ),
'group_title' => esc_html__( 'Accordion Title', 'plugin-name' ),
'limit' => 50,
'sortable' => true,
),
'fields' => array(
array(
'id' => 'group_1_group_1_group_1_text_1',
'type' => 'text',
'title' => esc_html__( 'Text', 'plugin-name' ),
'attributes' => array(
// mark this field az title, on type this will change group item title
'data-title' => 'title',
'placeholder' => esc_html__( 'Some text', 'plugin-name' ),
),
),
),
),
),
),
),
),