woocommerce_wp_textarea_input()
Output a textarea input box.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
woocommerce_wp_textarea_input( $field, $data );
- $field(массив) (обязательный)
- Field data.
- $data(WC_Data)
- WC_Data object, will be preferred over post object when passed.
По умолчанию: null
Код woocommerce_wp_textarea_input() woocommerce wp textarea input WC 9.2.3
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 '<p class="form-field ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"> <label for="' . esc_attr( $field['id'] ) . '">' . wp_kses_post( $field['label'] ) . '</label>'; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { echo wc_help_tip( $field['description'] ); } echo '<textarea class="' . esc_attr( $field['class'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . esc_attr( $field['name'] ) . '" id="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" rows="' . esc_attr( $field['rows'] ) . '" cols="' . esc_attr( $field['cols'] ) . '" ' . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $field['value'] ) . '</textarea> '; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>'; } echo '</p>'; }