Group "std" doesn't work on frontend ?
Support › MB Frontend Submission › Group "std" doesn't work on frontend ?Resolved
- This topic has 9 replies, 2 voices, and was last updated 6 years ago by
Kevin.
-
AuthorPosts
-
October 10, 2019 at 10:53 PM #16467
Kevin
ParticipantHi,
is the "std" paramters of group filedtype is working with front end submission/edition, i can see it works on backend but i need it to work on front end, and it doesn't seems to do so :/
I've already tested rwmb_frontend_field_{attributes} (both query and hook), unsuccessfully.
Hope you can help on this
have a nice day,
KevinOctober 11, 2019 at 2:47 PM #16479Anh Tran
KeymasterHi Kevin, the
std
param should work on both back end and front end. I added some docs on settingstd
for groups a couple of days ago, please take a look.October 11, 2019 at 3:21 PM #16482Kevin
ParticipantHi Anh,
i did, here's my code (set in fields, as i say, everything works fine on backend) :
thanks for your help
October 11, 2019 at 3:43 PM #16483Kevin
Participantjust to be sure i'm not missing anything, here's a pastebin
October 11, 2019 at 5:27 PM #16484Kevin
ParticipantSorry i wasn' t clear enough in my previous answer, it sill not working on front end, even with the code set up in the previous pastebin
October 12, 2019 at 10:33 AM #16495Anh Tran
KeymasterHi Kevin, I see the problem. Let me check and fix it.
October 16, 2019 at 4:45 PM #16549Kevin
ParticipantHi Anh, as far as i can get from now, by editing group-field.php child_field_std() function, i successfully show the array in the field, but i don't understand how to show them in two separate clone. any clue ?
protected static function child_field_std( $parent, $child, $meta ) { // Respect 'std' value set in child field. if ( ! empty( $child['std'] ) ) { return $child['std']; } $meta = $parent['std']; foreach($meta as $k => $v): $std[$k] = $meta[$k][$child['id']] = $v[$child['id']]; endforeach; // $meta contains $parent['std'] or clone's std. //$std = isset( $meta[$child['id']] ) ? $meta[$child['id']] : ''; return $std; }
thanks for your help,
KOctober 16, 2019 at 8:19 PM #16550Kevin
Participantok, i finally get it,
in group-field.php, under the html() function, you have to check if $field['std'] isset or not
line 108 :
// Remove filter to child field meta value and reset class's parent field's meta. if(!isset($field['std']))://ADD THIS if ( empty( self::$meta_queue ) ) { remove_filter( 'rwmb_field_meta', array( __CLASS__, 'child_field_meta' ) ); } endif;//AND THIS
and all works fine now.
Hope these helps
Thanks
KOctober 18, 2019 at 12:04 PM #16581Anh Tran
KeymasterHi Kevin,
Thanks a lot for your help. I was able to fix this issue another way and just released the version 1.3.6 of the plugin. Meta Box AIO and MB Core will be released later today.
October 18, 2019 at 3:55 PM #16594Kevin
ParticipantThanks Anh
have a nice day
K -
AuthorPosts
- You must be logged in to reply to this topic.