Closed cedricDevWP closed 4 years ago
Hi!
As you've noticed af_get_field
won't go down nested groups. This is because there could be naming collisions of fields causing unexpected behavior.
The way ACF handles this makes it a bit hard. Because these fields are considered sub fields you have to go through the parent field to find its value. I would recommend doing something like this to fetch a sub field of a group: af_get_field( 'groupe' )[ 'civilite' ]
.
I've been thinking of ways to make this easier for a while but haven't come up with a good solution yet. Sorry about that!
I commented on this problem https://github.com/advancedforms/advanced-forms/issues/35 but I prefer to create a new one.
Hi,
I think there is a problem when you have a group that owns another group.
Example :
1 ACF :
who has a acf dog (see 2 ACF)
2 ACF :
Who has a acf owner (see 3 ACF)
3 ACF :
If i do :
af_get_field("civilite")
=> Return falseWhen i see the data :
We do not go through the group
to correct I add:
if ( $sub_field_name == $field_key_or_name ) { return $sub_field_value; }elseif( $sub_field_name == 'groupe'){ foreach ($sub_field_value as $sub_field_name_2 => $sub_field_value_2) { if ( $sub_field_name_2 == $field_key_or_name ) { return $sub_field_value_2; } } }
for the future it would not be judicious to use the indentifiants and not the names like key?