WC_Settings_API::generate_decimal_html()
Generate Decimal Input HTML.
Method of the class: WC_Settings_API{}
No Hooks.
Return
String
.
Usage
$WC_Settings_API = new WC_Settings_API(); $WC_Settings_API->generate_decimal_html( $key, $data );
- $key(string) (required)
- Field key.
- $data(array) (required)
- Field data.
Changelog
Since 1.0.0 | Introduced. |
WC_Settings_API::generate_decimal_html() WC Settings API::generate decimal html code WC 9.5.1
<?php public function generate_decimal_html( $key, $data ) { $field_key = $this->get_field_key( $key ); $defaults = array( 'title' => '', 'disabled' => false, 'class' => '', 'css' => '', 'placeholder' => '', 'type' => 'text', 'desc_tip' => false, 'description' => '', 'custom_attributes' => array(), ); $data = wp_parse_args( $data, $defaults ); ob_start(); ?> <tr valign="top"> <th scope="row" class="titledesc"> <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?> <?php echo $this->get_tooltip_html( $data ); // WPCS: XSS ok. ?></label> </th> <td class="forminp"> <fieldset> <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> <input class="wc_input_decimal input-text regular-input <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field_key ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( wc_format_localized_decimal( $this->get_option( $key ) ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); // WPCS: XSS ok. ?> /> <?php echo $this->get_description_html( $data ); // WPCS: XSS ok. ?> </fieldset> </td> </tr> <?php return ob_get_clean(); }