• v 0.9.9.9

    parts/meta-boxes/a_metabox.php
    <?php
    /*
    Title: Some title
    Post Type: some_cpt
    */
    piklist('field', [
        'type' => 'group'
        ,'field' => 'group_name'
        ,'label' => 'Group label'
        ,'add_more' => true
        ,'template' => 'field'
        ,'fields' => [ ... ]
        ]

    1. Add 4 entries to the group.
    2. Save the post.
    3. Reopen post
    4. Delete (“minus” button) 3rd entry from the group
    5. Save the post

    When you first time save the group with 4 entries you’ll have
    an array

    [0 = > [..fields], 1 => [..fields], 2 => [..fields], 3 => [..fields]]

    But after deletion, the group will be saved like

    [0 = > [..fields], 1 => [..fields], 3 => [..fields]]

    Indexes are not sequential. On the fronted Piklist displays only the entries up to the gap (0 and 1 indexes).

    To make indexes sequential I do

    array_splice($new_settings['group_name'], 0, 0);

    inside

    piklist_pre_update_option

    hook handler.

    Is this a bug?

    https://www.ads-software.com/plugins/piklist/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Steve Bruner

    (@sbruner)

    If you remove your function that’s hooked to piklist_pre_update_option, does it work?

    Thread Starter John_G

    (@john_g)

    I don’t know weather you did not read my message thoroughly or you did not test the scenario.

    PHP 7.0.6
    Fresh WordPress 4.6
    Piklist 0.9.9.9
    No hook handlers added.

    Piklist demos -> Add-More's -> Todo's (Serialized Group)

    The same behavior I explained earlier.

    Plugin Author Steve Bruner

    (@sbruner)

    Try v0.9.9.10 it supports php 7.1

    Thread Starter John_G

    (@john_g)

    Nothing changed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Deleting entries from a group, breaks fronted (meta-boxes)’ is closed to new replies.