<?php
 namespace Extension;
 use TCMS\ControlExtension;
 class ColorPickerDefault extends ControlExtension {
 private $option = [ 'name' => 'color', 'defaultValue' => '#ffffff' ];
 public function render($value, $option = null) {
 copy_option($this->option, $option);
 $this->addStyle(asset('color-picker-default/spectrum.min.css'));
 if($value) echo '<input type="text" readonly value="' . $value . '" name="' . $this->option['name'] . '" class="color-picker-default form-control" />';
 else echo '<input type="text" readonly value="' . $this->option['defaultValue'] . '" name="' . $this->option['name'] . '" class="color-picker-default form-control" />';
 $this->addScript(asset('color-picker-default/spectrum.min.js'));
 $this->addScript(asset('color-picker-default/color-picker-default.js'));
 }
 }
