email input

This commit is contained in:
James Koster 2015-03-27 11:48:25 +00:00
parent 23932dbfca
commit 33a3940501
2 changed files with 22 additions and 4 deletions

View File

@ -953,10 +953,11 @@ class WC_Countries {
if ( $type == 'billing_' ) { if ( $type == 'billing_' ) {
$address_fields['billing_email'] = array( $address_fields['billing_email'] = array(
'label' => __( 'Email Address', 'woocommerce' ), 'label' => __( 'Email Address', 'woocommerce' ),
'required' => true, 'required' => true,
'class' => array( 'form-row-first' ), 'type' => 'email',
'validate' => array( 'email' ), 'class' => array( 'form-row-first' ),
'validate' => array( 'email' ),
); );
$address_fields['billing_phone'] = array( $address_fields['billing_phone'] = array(

View File

@ -1770,6 +1770,23 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field .= '</p>' . $after; $field .= '</p>' . $after;
break;
case 'email' :
$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="email" 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; break;
case 'select' : case 'select' :