Home › Forums › Front-end Issues › Group in a group. Show label. get_field_object
Hello,
I do not know how to continue. That’s why I turn to you.
I have a field group in which I have created groups. In one group, I have also created another group in which there are a lot of text boxes.
I read the group with the code:
$ grouppersdata = get_field ('group_pers_data', $ user_idd);
And now to read out a value from the second group, I use the following code.
echo = $ grouppersdata ['group_interview'] ['answer_1'];
That works great too.
I thought, because I have the text anyway in the label, which I need, it would be easy, if I just select label.
So now I want to see the label.
But I can not get that.
If I use this:
$grouppersobject = get_field_object ('group_pers_data', $ user_idd);
//or
$grouppersobject = get_field_object ('field_number from group_pers_data', $ user_idd);
I get an array.
If I use $grouppersobject = get_field_object ('group_interview', $ user_idd);
I do not get an array.
If I use $grouppersobject = get_field_object ('field_number drom group_interview', $ user_idd);
I also get an array.
But I can not bring the label with me then
echo = $grouppersobject ['group_interview'] ['answer_1'];
select
I’ve already tried $grouppersobject ['group_interview'] ['answer_1'] ['label']
. But I do not get the label displayed.
What am I doing wrong?
There are questions in the label of the group and I would like to read the group “group_interview”. Once the questions (label) and once the answer [‘group_interview’] [‘answer_1’] (answer_2, _3, _4, …).
If I select the group “group_interview” with the Field_ID, I get an array.
But how do I get the label from the text box [‘answer_1’]?
Does anyone have a tip or can help?
I would use the field key to get the field object
get_field_object('field_12345');
You might also try this, but I do not know if it will work…
get_field_object('{$parent_group_name}_{$child_group_name}_{$sub_field_name}')
I have solved it with this way now.
$grouppersobject = get_field_object('field_number from group_interview', $user_id);
$grouppersobject['sub_fields']['0']['label'];
Is working. Can one make it like this? Yes or?
Many thanks.
The topic ‘Group in a group. Show label. get_field_object’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.