1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?php
class Papi_Property_Color extends Papi_Property {
public function get_default_settings() {
return [
'palettes' => [],
'show_input' => true
];
}
public function html() {
$settings = $this->get_settings();
$value = $this->get_value();
papi_render_html_tag( 'div', [
'class' => 'papi-property-color-picker',
papi_html_tag( 'input', [
'data-palettes' => $settings->palettes ? $settings->palettes : true,
'id' => $this->html_id(),
'name' => $this->html_name(),
'type' => $settings->show_input === true ? 'text' : 'hidden',
'value' => $value,
] )
] );
}
}