mirror of
https://ghproxy.net/https://github.com/AlxMedia/curver.git
synced 2025-08-28 11:50:25 +08:00
Update to Kirki 4.2.0
This commit is contained in:
parent
cbfd4f27e4
commit
77ecd4ca69
440 changed files with 6230 additions and 5211 deletions
21
functions/kirki/kirki-packages/control-radio/LICENSE
Normal file
21
functions/kirki/kirki-packages/control-radio/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 kirki-framework
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
functions/kirki/kirki-packages/control-radio/dist/control.css
vendored
Normal file
2
functions/kirki/kirki-packages/control-radio/dist/control.css
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.customize-control-kirki-radio label{display:list-item;margin-bottom:7px}.customize-control-kirki-radio label .option-description{color:rgba(0,0,0,.35);display:block;font-size:.9em;padding-left:25px}.customize-control-kirki-radio-buttonset .buttonset{display:flex;flex-wrap:wrap}.customize-control-kirki-radio-buttonset .buttonset .switch-label{background:rgba(0,0,0,.1);border:1px rgba(0,0,0,.1);color:#555d66;flex-grow:1;margin:0;padding:.5em 1em;text-align:center}.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked+.switch-label{background-color:#00a0d2;color:hsla(0,0%,100%,.8)}.customize-control-kirki-radio-buttonset .screen-reader-text:focus{clip-path:inset(50%);-webkit-clip-path:inset(50%)}.customize-control-kirki-radio-image>.image{display:flex;flex-wrap:wrap}.customize-control-kirki-radio-image label{display:inline-block;position:relative}.customize-control-kirki-radio-image label .image-label{background:hsla(0,0%,100%,.7);display:none;font-weight:700;height:100%;left:0;position:absolute;top:0;width:100%}.customize-control-kirki-radio-image label .image-label .inner{height:100%;padding:.5em;text-align:center;vertical-align:middle;width:100%}.customize-control-kirki-radio-image label:hover .image-label{display:block}.customize-control-kirki-radio-image input{display:none}.customize-control-kirki-radio-image input img{border:1px solid transparent}.customize-control-kirki-radio-image input:checked+label img{border:1px solid #3498db;-webkit-box-shadow:0 0 5px 2px rgba(0,0,0,.25);box-shadow:0 0 5px 2px rgba(0,0,0,.25)}.customize-control-kirki-radio-image input+label .image-clickable{bottom:0;height:100%;left:0;position:absolute;right:0;top:0;width:100%}
|
||||
/*# sourceMappingURL=control.css.map */
|
1
functions/kirki/kirki-packages/control-radio/dist/control.css.map
vendored
Normal file
1
functions/kirki/kirki-packages/control-radio/dist/control.css.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"mappings":"AACE,qCACE,iBAAA,CACA,iBCAJ,CDGE,yDAEE,qBAAA,CADA,aAAA,CAEA,cAAA,CACA,iBCDJ,CCRE,oDACE,YAAA,CACA,cDWJ,CCTI,kEACE,yBAAA,CACA,yBAAA,CACA,aAAA,CAIA,WAAA,CAHA,QAAA,CAEA,gBAAA,CADA,iBDaN,CCNQ,wFACE,wBAAA,CACA,wBDQV,CCFE,mEACE,oBAAA,CACA,4BDIJ,CE9BE,4CACE,YAAA,CACA,cFiCJ,CE9BE,2CAEE,oBAAA,CADA,iBFiCJ,CE7BE,wDAOE,6BAAA,CANA,YAAA,CAOA,eAAA,CAFA,WAAA,CAFA,MAAA,CAFA,iBAAA,CACA,KAAA,CAEA,UFkCJ,CE5BE,+DAEE,WAAA,CAEA,YAAA,CADA,iBAAA,CAEA,qBAAA,CAJA,UFkCJ,CE3BE,8DACE,aF6BJ,CE1BE,2CACE,YF4BJ,CEzBE,+CACE,4BF2BJ,CExBE,6DAGE,wBAAA,CAFA,8CAAA,CACA,sCF2BJ,CEvBE,kEAGE,QAAA,CAIA,WAAA,CAHA,MAAA,CAHA,iBAAA,CAIA,OAAA,CAHA,KAAA,CAIA,UF0BJ","sources":["src/scss/_radio.scss","%3Cinput%20css%20w1CpKN%3E","src/scss/_radio-buttonset.scss","src/scss/_radio-image.scss"],"sourcesContent":[".customize-control-kirki-radio {\n label {\n display: list-item;\n margin-bottom: 7px;\n }\n\n label .option-description {\n display: block;\n color: rgba(0, 0, 0, 0.35);\n font-size: 0.9em;\n padding-left: 25px;\n }\n}\n",".customize-control-kirki-radio label {\n display: list-item;\n margin-bottom: 7px;\n}\n.customize-control-kirki-radio label .option-description {\n display: block;\n color: rgba(0, 0, 0, 0.35);\n font-size: 0.9em;\n padding-left: 25px;\n}\n\n.customize-control-kirki-radio-buttonset .buttonset {\n display: flex;\n flex-wrap: wrap;\n}\n.customize-control-kirki-radio-buttonset .buttonset .switch-label {\n background: rgba(0, 0, 0, 0.1);\n border: 1px rgba(0, 0, 0, 0.1);\n color: #555d66;\n margin: 0;\n text-align: center;\n padding: 0.5em 1em;\n flex-grow: 1;\n}\n.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label {\n background-color: #00a0d2;\n color: rgba(255, 255, 255, 0.8);\n}\n.customize-control-kirki-radio-buttonset .screen-reader-text:focus {\n clip-path: inset(50%);\n -webkit-clip-path: inset(50%);\n}\n\n.customize-control-kirki-radio-image > .image {\n display: flex;\n flex-wrap: wrap;\n}\n.customize-control-kirki-radio-image label {\n position: relative;\n display: inline-block;\n}\n.customize-control-kirki-radio-image label .image-label {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(255, 255, 255, 0.7);\n font-weight: 700;\n}\n.customize-control-kirki-radio-image label .image-label .inner {\n width: 100%;\n height: 100%;\n text-align: center;\n padding: 0.5em;\n vertical-align: middle;\n}\n.customize-control-kirki-radio-image label:hover .image-label {\n display: block;\n}\n.customize-control-kirki-radio-image input {\n display: none;\n}\n.customize-control-kirki-radio-image input img {\n border: 1px solid transparent;\n}\n.customize-control-kirki-radio-image input:checked + label img {\n -webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);\n box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);\n border: 1px solid #3498db;\n}\n.customize-control-kirki-radio-image input + label .image-clickable {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n}\n/*# sourceMappingURL=control.css.map */\n",".customize-control-kirki-radio-buttonset {\n .buttonset {\n display: flex;\n flex-wrap: wrap;\n\n .switch-label {\n background: rgba(0,0,0,.1);\n border: 1px rgba(0,0,0,.1);\n color: #555d66;\n margin: 0;\n text-align: center;\n padding: 0.5em 1em;\n flex-grow: 1;\n }\n\n .switch-input {\n &:checked {\n + .switch-label {\n background-color: #00a0d2;\n color: rgba(255, 255, 255, 0.8);\n }\n }\n }\n }\n\n .screen-reader-text:focus {\n clip-path: inset(50%);\n -webkit-clip-path: inset(50%);\n }\n}\n",".customize-control-kirki-radio-image {\n > .image {\n display: flex;\n flex-wrap: wrap;\n }\n\n label {\n position: relative;\n display: inline-block;\n }\n\n label .image-label {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(255, 255, 255, 0.7);\n font-weight: 700;\n }\n\n label .image-label .inner {\n width: 100%;\n height: 100%;\n text-align: center;\n padding: 0.5em;\n vertical-align: middle;\n }\n\n label:hover .image-label {\n display: block;\n }\n\n input {\n display: none;\n }\n\n input img {\n border: 1px solid transparent;\n }\n\n input:checked + label img {\n -webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);\n box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);\n border: 1px solid #3498db;\n }\n\n input + label .image-clickable {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n }\n}\n\n"],"names":[],"version":3,"file":"control.css.map"}
|
2
functions/kirki/kirki-packages/control-radio/dist/control.js
vendored
Normal file
2
functions/kirki/kirki-packages/control-radio/dist/control.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
wp.customize.controlConstructor["kirki-radio"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-buttonset"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-radio-image"]=wp.customize.kirkiDynamicControl.extend({});
|
||||
//# sourceMappingURL=control.js.map
|
1
functions/kirki/kirki-packages/control-radio/dist/control.js.map
vendored
Normal file
1
functions/kirki/kirki-packages/control-radio/dist/control.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"mappings":"AAEAA,GAAGC,UAAUC,mBAAkB,eAA4BF,GAAGC,UAAUE,oBAAoBC,OAAM,IAClGJ,GAAGC,UAAUC,mBAAkB,yBAA4BF,GAAGC,UAAUE,oBAAoBC,OAAM,IAClGJ,GAAGC,UAAUC,mBAAkB,qBAA4BF,GAAGC,UAAUE,oBAAoBC,OAAM","sources":["src/control.js"],"sourcesContent":["import \"./control.scss\";\n\nwp.customize.controlConstructor['kirki-radio'] = wp.customize.kirkiDynamicControl.extend( {} );\nwp.customize.controlConstructor['kirki-radio-buttonset'] = wp.customize.kirkiDynamicControl.extend( {} );\nwp.customize.controlConstructor['kirki-radio-image'] = wp.customize.kirkiDynamicControl.extend( {} );\n"],"names":["wp","customize","controlConstructor","kirkiDynamicControl","extend"],"version":3,"file":"control.js.map"}
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Control: kirki-radio.
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\Control\Base;
|
||||
use Kirki\URL;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio control
|
||||
*/
|
||||
class Radio extends Base {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio';
|
||||
|
||||
/**
|
||||
* The version. Used in scripts & styles for cache-busting.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public static $control_ver = '1.1';
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
parent::enqueue();
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
|
||||
|
||||
// Enqueue the style.
|
||||
wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
<span class="customize-control-title">{{{ data.label }}}</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<# _.each( data.choices, function( val, key ) { #>
|
||||
<label>
|
||||
<input
|
||||
{{{ data.inputAttrs }}}
|
||||
type="radio"
|
||||
data-id="{{ data.id }}"
|
||||
value="{{ key }}"
|
||||
{{ data.link }}
|
||||
name="_customize-radio-{{ data.id }}"
|
||||
<# if ( data.value === key ) { #> checked<# } #>
|
||||
/>
|
||||
<# if ( _.isArray( val ) ) { #>
|
||||
{{{ val[0] }}}<span class="option-description">{{{ val[1] }}}</span>
|
||||
<# } else { #>
|
||||
{{ val }}
|
||||
<# } #>
|
||||
</label>
|
||||
<# } ); #>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Control: radio-buttonset.
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\Control\Base;
|
||||
use Kirki\Control\Radio;
|
||||
use Kirki\URL;
|
||||
|
||||
/**
|
||||
* Radio Buttonset control (modified radio)
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Radio_Buttonset extends Base {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio-buttonset';
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue() {
|
||||
parent::enqueue();
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], Radio::$control_ver, false );
|
||||
|
||||
// Enqueue the style.
|
||||
wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], Radio::$control_ver );
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
|
||||
<div id="input_{{ data.id }}" class="buttonset">
|
||||
<# for ( key in data.choices ) { #>
|
||||
<input {{{ data.inputAttrs }}} class="switch-input screen-reader-text" type="radio" value="{{ key }}" name="_customize-radio-{{{ data.id }}}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( key === data.value ) { #> checked="checked" <# } #>>
|
||||
<label class="switch-label switch-label-<# if ( key === data.value ) { #>on <# } else { #>off<# } #>" for="{{ data.id }}{{ key }}">{{{ data.choices[ key ] }}}</label>
|
||||
</input>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Control: radio-image.
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\Control\Base;
|
||||
use Kirki\URL;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio Image control (modified radio).
|
||||
*/
|
||||
class Radio_Image extends Base {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio-image';
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
parent::enqueue();
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script( 'kirki-control-radio', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], Radio::$control_ver, false );
|
||||
|
||||
// Enqueue the style.
|
||||
wp_enqueue_style( 'kirki-control-radio-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], Radio::$control_ver );
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @see WP_Customize_Control::to_json()
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
if ( 'style' !== $attr ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
continue;
|
||||
}
|
||||
$this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
<label class="customizer-text">
|
||||
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
|
||||
</label>
|
||||
<div id="input_{{ data.id }}" class="image">
|
||||
<# for ( key in data.choices ) { #>
|
||||
<# dataAlt = ( _.isObject( data.choices[ key ] ) && ! _.isUndefined( data.choices[ key ].alt ) ) ? data.choices[ key ].alt : '' #>
|
||||
<input {{{ data.inputAttrs }}} class="image-select" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #> data-alt="{{ dataAlt }}">
|
||||
<label for="{{ data.id }}{{ key }}" {{{ data.labelStyle }}} class="{{{ data.id + key }}}">
|
||||
<# if ( _.isObject( data.choices[ key ] ) ) { #>
|
||||
<img src="{{ data.choices[ key ].src }}" alt="{{ data.choices[ key ].alt }}">
|
||||
<span class="image-label"><span class="inner">{{ data.choices[ key ].alt }}</span></span>
|
||||
<# } else { #>
|
||||
<img src="{{ data.choices[ key ] }}">
|
||||
<# } #>
|
||||
<span class="image-clickable"></span>
|
||||
</label>
|
||||
</input>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?php // phpcs:disable PHPCompatibility.FunctionDeclarations.NewClosure
|
||||
/**
|
||||
* Override field methods
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Field;
|
||||
|
||||
use Kirki\Field;
|
||||
|
||||
/**
|
||||
* Field overrides.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Radio extends Field {
|
||||
|
||||
/**
|
||||
* The field type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio';
|
||||
|
||||
/**
|
||||
* The control class-name.
|
||||
*
|
||||
* @access protected
|
||||
* @since 0.1
|
||||
* @var string
|
||||
*/
|
||||
protected $control_class = '\Kirki\Control\Radio';
|
||||
|
||||
/**
|
||||
* Whether we should register the control class for JS-templating or not.
|
||||
*
|
||||
* @access protected
|
||||
* @since 0.1
|
||||
* @var bool
|
||||
*/
|
||||
protected $control_has_js_template = true;
|
||||
|
||||
/**
|
||||
* Filter arguments before creating the setting.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @param array $args The field arguments.
|
||||
* @param WP_Customize_Manager $wp_customize The customizer instance.
|
||||
* @return array
|
||||
*/
|
||||
public function filter_setting_args( $args, $wp_customize ) {
|
||||
if ( $args['settings'] === $this->args['settings'] ) {
|
||||
$args = parent::filter_setting_args( $args, $wp_customize );
|
||||
|
||||
// Set the sanitize-callback if none is defined.
|
||||
if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
|
||||
$args['sanitize_callback'] = function( $value ) {
|
||||
if ( ! isset( $this->args['choices'][ $value ] ) ) {
|
||||
return ( isset( $this->args['default'] ) ) ? $this->args['default'] : '';
|
||||
}
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter arguments before creating the control.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @param array $args The field arguments.
|
||||
* @param WP_Customize_Manager $wp_customize The customizer instance.
|
||||
* @return array
|
||||
*/
|
||||
public function filter_control_args( $args, $wp_customize ) {
|
||||
if ( $args['settings'] === $this->args['settings'] ) {
|
||||
$args = parent::filter_control_args( $args, $wp_customize );
|
||||
$args['type'] = 'kirki-radio';
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Override field methods
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Field;
|
||||
|
||||
/**
|
||||
* Field overrides.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Radio_Buttonset extends Radio {
|
||||
|
||||
/**
|
||||
* The field type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio-buttonset';
|
||||
|
||||
/**
|
||||
* The control class-name.
|
||||
*
|
||||
* @access protected
|
||||
* @since 0.1
|
||||
* @var string
|
||||
*/
|
||||
protected $control_class = '\Kirki\Control\Radio_Buttonset';
|
||||
|
||||
/**
|
||||
* Filter arguments before creating the control.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @param array $args The field arguments.
|
||||
* @param WP_Customize_Manager $wp_customize The customizer instance.
|
||||
* @return array
|
||||
*/
|
||||
public function filter_control_args( $args, $wp_customize ) {
|
||||
if ( $args['settings'] === $this->args['settings'] ) {
|
||||
$args = parent::filter_control_args( $args, $wp_customize );
|
||||
$args['type'] = 'kirki-radio-buttonset';
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Override field methods
|
||||
*
|
||||
* @package kirki-framework/control-radio
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Field;
|
||||
|
||||
/**
|
||||
* Field overrides.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Radio_Image extends Radio {
|
||||
|
||||
/**
|
||||
* The field type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-radio-image';
|
||||
|
||||
/**
|
||||
* The control class-name.
|
||||
*
|
||||
* @access protected
|
||||
* @since 0.1
|
||||
* @var string
|
||||
*/
|
||||
protected $control_class = '\Kirki\Control\Radio_Image';
|
||||
|
||||
/**
|
||||
* Filter arguments before creating the control.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @param array $args The field arguments.
|
||||
* @param WP_Customize_Manager $wp_customize The customizer instance.
|
||||
* @return array
|
||||
*/
|
||||
public function filter_control_args( $args, $wp_customize ) {
|
||||
if ( $args['settings'] === $this->args['settings'] ) {
|
||||
$args = parent::filter_control_args( $args, $wp_customize );
|
||||
$args['type'] = 'kirki-radio-image';
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import "./control.scss";
|
||||
|
||||
wp.customize.controlConstructor['kirki-radio'] = wp.customize.kirkiDynamicControl.extend( {} );
|
||||
wp.customize.controlConstructor['kirki-radio-buttonset'] = wp.customize.kirkiDynamicControl.extend( {} );
|
||||
wp.customize.controlConstructor['kirki-radio-image'] = wp.customize.kirkiDynamicControl.extend( {} );
|
|
@ -0,0 +1,3 @@
|
|||
@import "./scss/radio";
|
||||
@import "./scss/radio-buttonset";
|
||||
@import "./scss/radio-image";
|
|
@ -0,0 +1,30 @@
|
|||
.customize-control-kirki-radio-buttonset {
|
||||
.buttonset {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.switch-label {
|
||||
background: rgba(0,0,0,.1);
|
||||
border: 1px rgba(0,0,0,.1);
|
||||
color: #555d66;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
padding: 0.5em 1em;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.switch-input {
|
||||
&:checked {
|
||||
+ .switch-label {
|
||||
background-color: #00a0d2;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.screen-reader-text:focus {
|
||||
clip-path: inset(50%);
|
||||
-webkit-clip-path: inset(50%);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
.customize-control-kirki-radio-image {
|
||||
> .image {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
label .image-label {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
label .image-label .inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
padding: 0.5em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
label:hover .image-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input img {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
input:checked + label img {
|
||||
-webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid #3498db;
|
||||
}
|
||||
|
||||
input + label .image-clickable {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
.customize-control-kirki-radio {
|
||||
label {
|
||||
display: list-item;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
label .option-description {
|
||||
display: block;
|
||||
color: rgba(0, 0, 0, 0.35);
|
||||
font-size: 0.9em;
|
||||
padding-left: 25px;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue