public static function field_is_repeater_child($form, $field_id)
 {
     if (GF_Field_Repeater::get_field_index($form) === false) {
         return false;
     }
     $fieldIsRepeaterChild = false;
     $repeaterChildren = array();
     foreach ($form['fields'] as $key => $field) {
         if ($field->type == 'repeater') {
             if (is_array($field->repeaterChildren)) {
                 $repeaterChildren = array_merge($repeaterChildren, $field->repeaterChildren);
             }
         }
         if (!empty($repeaterChildren)) {
             if ($field->id == $field_id && in_array($field->id, $repeaterChildren)) {
                 $fieldIsRepeaterChild = true;
                 break;
             }
         }
     }
     return $fieldIsRepeaterChild;
 }
예제 #2
0
 public static function get_field_type($form, $id)
 {
     $field_index = GF_Field_Repeater::get_field_index($form, 'id', $id);
     if ($field_index !== false) {
         return $form['fields'][$field_index]['type'];
     }
     return false;
 }