Custom Fields
Re-Envisioned
Support Meta Box Group Lots of issues with Groups and Nested Groups

  • Creator
    Topic
  • #20856
    Resolved adamdavies
    Participant

    Hi,

    Seem to having multiple issues with groups. Extensions and main plugin all latest versions.

    • If parent clone button is clicked all nested groups expand (whether collapsible or not when tested)
    • If sibling groups are collapsed, when clicking clone button, no fields are displayed on new clone until collapse toggle is clicked.
    • Group titles simply not working. Tried the older method:
      'group_title'=>['field' => 'item_title']
      and the new
      'group_title'=>'{item_title}'

    If I’m doing something wrong please let me know but tried multiple collapsible settings, disabling plugins and re-enabling (No errors) and getting no where.

    $meta_boxes[] = [
                    'title' => 'Menu Items',
                    'post_types' => 'ttemenu',
                    'fields' => [
                        [
                            'name' =>
                                'Menu item<br/><small style="padding-right: 15px; margin-top: 15px; display: block;">Add menu item and their required information.</small>',
                            'id' => 'menu_items',
                            'type' => 'group',
                            'clone' => true,
                            'collapsible' => true,
                            'group_title' => ['field' => 'item_name'],
                            'save_state' => true,
                            'add_button' => 'Add menu item',
                            'fields' => [
                                [
                                    'name' => 'Item name',
                                    'id' => 'item_name',
                                    'type' => 'text',
                                ],
                                [
                                    'name' => 'Item description',
                                    'id' => 'item_desc',
                                    'type' => 'textarea',
                                ],
                                [
                                    'name' => 'Multi Pricing?',
                                    'desc' => 'Whether item has multiple prices (eg sml and lrg)',
                                    'id' => 'multi_price',
                                    'type' => 'checkbox',
                                ],
                                [
                                    'name' => 'Item price',
                                    'desc' => '10.00, 15.00 etc',
                                    'id' => 'item_price',
                                    'type' => 'text',
                                    'hidden' => ['multi_price', '!=', false],
                                ],
                                [
                                    'name' => 'Multi-Pricing', // Optional
                                    'id' => 'group_id',
                                    'type' => 'group',
                                    'clone' => 'true',
                                    'collapsible' => true,
                                    'default_state' => 'collapsed',
                                    'group_title' =>
                                        '{multi_price_title} - &pound;{multi_item_price}',
                                    'add_button' => 'Add price',
                                    'fields' => [
                                        [
                                            'name' => 'Price Title',
                                            'desc' => 'Pint, pitcher etc',
                                            'id' => 'multi_price_title',
                                            'type' => 'text',
                                        ],
                                        [
                                            'name' => 'Item price',
                                            'desc' => '10.00, 15.00 etc',
                                            'id' => 'multi_item_price',
                                            'type' => 'text',
                                        ],
                                    ],
                                    'hidden' => ['multi_price', '!=', true], // hide if single pricing
                                ],
                                [
                                    'name' => 'Item tags',
                                    'desc' => 'Select food tags (vegan, vegetarian etc)',
                                    'id' => 'item_tags',
                                    'type' => 'taxonomy',
                                    'taxonomy' => 'menu_tags',
                                    'placeholder' => 'Select food tags',
                                ],
                            ],
                        ],
                    ],
                ];
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #20857
    Long Nguyen
    Moderator

    Hi Adam

    Please see my screen record, I’m using your code to test the field group.
    https://www.loom.com/share/a6be54a78970488f8eac30a86a922b88

    • Parent group cloning field: sub-group still collapses.
    • Sibling groups are collapsed: the new cloning group also collapses because it has the setting 'save_state' => true

    • The field ID item_title is wrong, please change it to item_name. The correct code is 'group_title' => '{item_name}'.

    If you see something wrong, please take and share a screen record of the issue. Thank you.

    #20883
    adamdavies
    Participant

    Thanks for the reply and sending the correct title tag back (was a long day),

    I will take a look and if I have any issues will screen record to demonstrate.

    Thanks again

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.