Deleting entries from a group, breaks fronted (meta-boxes)
-
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 postWhen 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?
Viewing 4 replies - 1 through 4 (of 4 total)
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.