Support

Account

Home Forums Front-end Issues Group in a group. Show label. get_field_object

Solved

Group in a group. Show label. get_field_object

    • Dj_PD

    • September 4, 2019 at 8:22 pm

    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}')
    
    • Dj_PD

    • September 4, 2019 at 11:36 pm

    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.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.