Created new colorpicker settings api field
This commit is contained in:
parent
6841ca81c9
commit
5ea4e1b0a7
|
@ -444,6 +444,52 @@ abstract class WC_Settings_API {
|
|||
return $this->generate_text_html( $key, $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Color Picker Input HTML.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $data
|
||||
* @since 2.3.0
|
||||
* @return string
|
||||
*/
|
||||
public function generate_colorpicker_html( $key, $data ) {
|
||||
$field = $this->plugin_id . $this->id . '_' . $key;
|
||||
$defaults = array(
|
||||
'title' => '',
|
||||
'disabled' => false,
|
||||
'class' => '',
|
||||
'css' => '',
|
||||
'placeholder' => '',
|
||||
'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 ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
|
||||
<?php echo $this->get_tooltip_html( $data ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
|
||||
<div class="color_box">
|
||||
<input class="colorpick <?php echo esc_attr( $data['class'] ); ?>" type="text" name="<?php echo esc_attr( $field ); ?>" id="<?php echo esc_attr( $field ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" value="<?php echo esc_attr( $this->get_option( $key ) ); ?>" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?> />
|
||||
<div id="colorPickerDiv_<?php echo esc_attr( $field ); ?>" class="colorpickdiv"></div>
|
||||
</div>
|
||||
<?php echo $this->get_description_html( $data ); ?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Textarea HTML.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue