This commit is contained in:
James Koster 2015-04-01 17:36:58 +01:00
parent b11f6753df
commit 944723d7ac
2 changed files with 23 additions and 5 deletions

View File

@ -961,11 +961,12 @@ class WC_Countries {
);
$address_fields['billing_phone'] = array(
'label' => __( 'Phone', 'woocommerce' ),
'required' => true,
'class' => array( 'form-row-last' ),
'clear' => true,
'validate' => array( 'phone' ),
'label' => __( 'Phone', 'woocommerce' ),
'required' => true,
'type' => 'tel',
'class' => array( 'form-row-last' ),
'clear' => true,
'validate' => array( 'phone' ),
);
}

View File

@ -1787,6 +1787,23 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field .= '</p>' . $after;
break;
case 'tel' :
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
if ( $args['label'] ) {
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>';
}
$field .= '<input type="tel" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
if ( $args['description'] ) {
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
}
$field .= '</p>' . $after;
break;
case 'select' :