$value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo '

'; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { echo wc_help_tip( $field['description'] ); } echo ' '; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '' . wp_kses_post( $field['description'] ) . ''; } echo '

'; } /** * Output a hidden input box. * * @param array $field Field data. * @param WC_Data $data WC_Data object, will be preferred over post object when passed. */ function woocommerce_wp_hidden_input( $field, WC_Data $data = null ) { global $post; $field['value'] = isset( $field['value'] ) ? $field['value'] : OrderUtil::get_post_or_object_meta( $post, $data, $field['id'], true ); $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; echo ' '; } /** * Output a textarea input box. * * @param array $field Field data. * @param WC_Data $data WC_Data object, will be preferred over post object when passed. */ function woocommerce_wp_textarea_input( $field, WC_Data $data = null ) { global $post; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = $field['value'] ?? OrderUtil::get_post_or_object_meta( $post, $data, $field['id'], true ); $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; $field['rows'] = isset( $field['rows'] ) ? $field['rows'] : 2; $field['cols'] = isset( $field['cols'] ) ? $field['cols'] : 20; // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo '

'; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { echo wc_help_tip( $field['description'] ); } echo ' '; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '' . wp_kses_post( $field['description'] ) . ''; } echo '

'; } /** * Output a checkbox input box. * * @param array $field Field data. * @param WC_Data $data WC_Data object, will be preferred over post object when passed. */ function woocommerce_wp_checkbox( $field, WC_Data $data = null ) { global $post; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = $field['value'] ?? OrderUtil::get_post_or_object_meta( $post, $data, $field['id'], true ); $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'yes'; $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo '

'; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { echo wc_help_tip( $field['description'] ); } echo ' '; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '' . wp_kses_post( $field['description'] ) . ''; } echo '

'; } /** * Output a select input box. * * @param array $field Field data. * @param WC_Data $data WC_Data object, will be preferred over post object when passed. */ function woocommerce_wp_select( $field, WC_Data $data = null ) { global $post; $field = wp_parse_args( $field, array( 'class' => 'select short', 'style' => '', 'wrapper_class' => '', 'value' => OrderUtil::get_post_or_object_meta( $post, $data, $field['id'], true ), 'name' => $field['id'], 'desc_tip' => false, 'custom_attributes' => array(), ) ); $wrapper_attributes = array( 'class' => $field['wrapper_class'] . " form-field {$field['id']}_field", ); $label_attributes = array( 'for' => $field['id'], ); $field_attributes = (array) $field['custom_attributes']; $field_attributes['style'] = $field['style']; $field_attributes['id'] = $field['id']; $field_attributes['name'] = $field['name']; $field_attributes['class'] = $field['class']; $tooltip = ! empty( $field['description'] ) && false !== $field['desc_tip'] ? $field['description'] : ''; $description = ! empty( $field['description'] ) && false === $field['desc_tip'] ? $field['description'] : ''; ?>

>

' . wp_kses_post( $field['label'] ) . ''; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { echo wc_help_tip( $field['description'] ); } echo ''; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '' . wp_kses_post( $field['description'] ) . ''; } echo ''; } /** * Output a note. * * @param array $field Field data. */ function woocommerce_wp_note( $field ) { $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; echo '

'; echo ''; echo '' . wp_kses_post( $field['message'] ) . ''; echo '

'; }