count($field['value']) ) { for( $i = 0; $i < $field['row_min']; $i++ ) { // already have a value? continue... if( isset($field['value'][$i]) ) { continue; } // populate values $field['value'][ $i ] = array(); foreach( $field['sub_fields'] as $sub_field) { $sub_value = false; if( !empty($sub_field['default_value']) ) { $sub_value = $sub_field['default_value']; } $field['value'][ $i ][ $sub_field['key'] ] = $sub_value; } } } // max rows $row_count = count($field['value']); if( $row_count > $field['row_limit'] ) { for( $i = 0; $i < $row_count; $i++ ) { if( $i >= $field['row_limit'] ) { unset( $field['value'][ $i ] ); } } } // setup values for row clone $field['value']['acfcloneindex'] = array(); foreach( $field['sub_fields'] as $sub_field ) { $sub_value = false; if( isset($sub_field['default_value']) ) { $sub_value = $sub_field['default_value']; } $field['value']['acfcloneindex'][ $sub_field['key'] ] = $sub_value; } // helper function which does not exist yet in acf if( !function_exists('acf_get_join_attr') ): function acf_get_join_attr( $attributes = false ) { // validate if( empty($attributes) ) { return ''; } // vars $e = array(); // loop through and render foreach( $attributes as $k => $v ) { $e[] = $k . '="' . esc_attr( $v ) . '"'; } // echo return implode(' ', $e); } endif; if( !function_exists('acf_join_attr') ): function acf_join_attr( $attributes = false ) { echo acf_get_join_attr( $attributes ); } endif; ?>
1 ): ?> 1 && isset($sub_field['column_width']) && $sub_field['column_width'] ) { $attr = 'width="' . $sub_field['column_width'] . '%"'; } // required $required_label = ""; if( $sub_field['required'] ) { $required_label = ' *'; } ?> $value ): ?> "> 1 ): ?>
>
"field sub_field field_type-{$sub_field['type']} field_key-{$sub_field['key']}", 'data-field_type' => $sub_field['type'], 'data-field_key' => $sub_field['key'], 'data-field_name' => $sub_field['name'] ); // required if( $sub_field['required'] ) { $attributes['class'] .= ' required'; } // layout: Row if( $field['layout'] == 'row' ): ?> >
>