Support › Meta Box Group › Getting label value of sub-fieldResolved
I've added the group extensions sample code that creates the Album Tracks on a CPT.
I retrieve the value of field 'standard' using $value = rwmb_meta( $field_id );
$value = rwmb_meta( $field_id );
I can access the value of genre using: $genre = $value['genre'];
$genre = $value['genre'];
However, the returned values are always the key-values, and I don't see an option to change that to either label or key-label value pairs. How can I go about to return the labels instead?
Thanks, I'm hoping I'm just missing something here.
Ok, so I ended up writing a walker function to fix this. If there's I setting I missed please let me know.
It's great that you found a solution. I think the rwmb_get_field_settings() function can help a little. It gives you the group field settings and then you can get the options for sub-field.
$group = rwmb_get_field_settings( 'group' );
$sub_field = $group['fields'];
$group_value = rwmb_meta( 'group' );
$sub_field_value = $group_value['sub_field'];
$label = $sub_field['options'][$sub_field_value];