How to get Gravity forms entry value by label?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function harsh_get_value_by_label( $form, $entry, $label ) {
    foreach ( $form['fields'] as $field ) {
        $lead_key = $field->label;
         
        if ( strtolower( $lead_key ) == strtolower( $label ) ) {
            return $entry[ $field->id ];
        }
        if($field->inputs != null and count($field->inputs))
        {
            foreach($field->inputs as $children)
            {
                $subLeadKey = $children["label"];
                if ( strtolower( $subLeadKey ) == strtolower( $label ) )
                {
                    return $entry[ $children["id"] ];
                }
            }
        }
    }
    return false;
}

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *