Date.php
75 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Customizer Control: kirki-date. |
| 4 | * |
| 5 | * @package kirki-framework/control-date |
| 6 | * @copyright Copyright (c) 2023, Themeum |
| 7 | * @license https://opensource.org/licenses/MIT |
| 8 | * @since 1.0 |
| 9 | */ |
| 10 | |
| 11 | namespace Kirki\Control; |
| 12 | |
| 13 | use Kirki\URL; |
| 14 | use Kirki\Control\Base; |
| 15 | |
| 16 | /** |
| 17 | * A simple date control, using vanilla JavaScript. |
| 18 | * |
| 19 | * @since 1.0 |
| 20 | */ |
| 21 | class Date extends Base { |
| 22 | |
| 23 | /** |
| 24 | * The control type. |
| 25 | * |
| 26 | * @access public |
| 27 | * @since 1.0 |
| 28 | * @var string |
| 29 | */ |
| 30 | public $type = 'kirki-date'; |
| 31 | |
| 32 | /** |
| 33 | * The version. Used in scripts & styles for cache-busting. |
| 34 | * |
| 35 | * @static |
| 36 | * @access public |
| 37 | * @since 1.0 |
| 38 | * @var string |
| 39 | */ |
| 40 | public static $control_ver = '1.0'; |
| 41 | |
| 42 | /** |
| 43 | * Enqueue control related scripts/styles. |
| 44 | * |
| 45 | * @access public |
| 46 | * @since 1.0 |
| 47 | * @return void |
| 48 | */ |
| 49 | |
| 50 | |
| 51 | /** |
| 52 | * An Underscore (JS) template for this control's content (but not its container). |
| 53 | * |
| 54 | * Class variables for this control class are available in the `data` JS object; |
| 55 | * export custom variables by overriding {@see WP_Customize_Control::to_json()}. |
| 56 | * |
| 57 | * @see WP_Customize_Control::print_template() |
| 58 | * |
| 59 | * @access protected |
| 60 | * @since 1.0 |
| 61 | * @return void |
| 62 | */ |
| 63 | protected function content_template() { |
| 64 | ?> |
| 65 | <label> |
| 66 | <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #> |
| 67 | <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #> |
| 68 | <div class="customize-control-content"> |
| 69 | <input {{{ data.inputAttrs }}} class="datepicker" type="text" id="{{ data.id }}" value="{{ data.value }}" {{{ data.link }}} /> |
| 70 | </div> |
| 71 | </label> |
| 72 | <?php |
| 73 | } |
| 74 | } |
| 75 |