clone _as_multiple not working
Support › MB Builder › clone _as_multiple not workingResolved
- This topic has 2 replies, 2 voices, and was last updated 4 years, 8 months ago by
toni bird.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
September 4, 2020 at 12:20 AM #21636
toni bird
ParticipantHi there, tried a few times to save clone as multiple, but does not work, data on database still the same serialized string.. code :
[ 'id' => $prefix . 'rdo_staff_group_D', 'type' => 'group', 'fields' => [ [ 'id' => $prefix . 'rdo_staff_D', 'name' => esc_html__( 'Funcao', 'text-domain' ), 'type' => 'select_advanced', 'options' => [ 'armador' => esc_html__( 'Armador', 'text-domain' ), 'soldador' => esc_html__( 'Soldador', 'text-domain' ), ], 'js_options' => [ 'size' => 25, ], 'columns' => 3, 'add_button' => esc_html__( '+ funcoes', 'text-domain' ), 'size' => 25, ], [ 'id' => $prefix . 'rdo_staff_DH', 'type' => 'number', 'name' => esc_html__( 'HHT', 'text-domain' ), 'min' => 1, 'max' => 9, 'step' => 1, 'columns' => 5, 'visible' => [ 'when' => [['rdo_staff_D', '!=', '']], 'relation' => 'and', ], ], ], 'clone' => 1, 'default_state' => 'collapsed', 'collapsible' => true, 'group_title' => '{rdo_staff_D}', 'add_button' => esc_html__( '+ adicionar MO', 'text-domain' ), 'save_state' => true, 'tab' => 'rdo_staff_tab', 'clone_as_multiple' => true, ],
result : a:1:{i:0;a:2:{s:11:"rdo_staff_D";s:7:"armador";s:12:"rdo_staff_DH";s:1:"9";}}
Any help?
thanks
September 4, 2020 at 10:26 AM #21646Long Nguyen
ModeratorHi,
The field
group
is a special field, it always saves the data in a serialized string. If you use the setting clone_as_multiple, instead of showing all data in a string, it will save data in more rows for each clone.Use clone_as_multiple:
a:1:{i:0;a:2:{s:11:”rdo_staff_D”;s:7:”armador”;s:12:”rdo_staff_DH”;s:1:”9″;}} a:1:{i:0;a:2:{s:11:”rdo_staff_D”;s:7:”armador”;s:12:”rdo_staff_DH”;s:1:”9″;}}
Not use:
a:2:{i:0;...; i:1...}
For more information, please follow this documentation https://metabox.io/introducing-clone-as-multiple-feature/.
September 5, 2020 at 1:45 AM #21663toni bird
ParticipantHi, thanks again, got it sorted using a different approach .
cheers
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.