The substitution format is as follows.
[FIELDGROUP_ROW_FIELDNAME]
Field Group = cb_myfields
First Row = 0
Field = cb_favoritecolor
This would give a substitution of the following.
[cb_myfields_0_cb_favoritecolor]
It's generally not ideal accessing the nested fields though. You'd have to know the exact row number and there's not a guarantee that row would always exist. Ideally you'd use PHP and access them via the JSON. Example as follows using the above.
Code:
return ( new \CBLib\Registry\Registry( $user->getString( 'cb_myfields', '' ) ) )->getString( '0.cb_favoritecolor' );
You can use PHP to loop through the Registry object for more control.
Code:
$colors = array();
foreach ( new \CBLib\Registry\Registry( $user->getString( 'cb_myfields', '' ) ) as $row => $fields ) {
$color = $fields->getString( 'cb_favoritecolor', '' );
if ( ! $color ) {
continue;
}
$colors = $color;
}
return $colors;