class-kirki-field-switch.php (1064B)
1 <?php 2 /** 3 * Override field methods 4 * 5 * @package Kirki 6 * @subpackage Controls 7 * @copyright Copyright (c) 2016, Aristeides Stathopoulos 8 * @license http://opensource.org/licenses/https://opensource.org/licenses/MIT 9 * @since 2.2.7 10 */ 11 12 if ( ! class_exists( 'Kirki_Field_Switch' ) ) { 13 14 /** 15 * Field overrides. 16 */ 17 class Kirki_Field_Switch extends Kirki_Field_Checkbox { 18 19 /** 20 * Sets the control type. 21 * 22 * @access protected 23 */ 24 protected function set_type() { 25 26 $this->type = 'kirki-switch'; 27 28 } 29 30 /** 31 * Sets the control choices. 32 * 33 * @access protected 34 */ 35 protected function set_choices() { 36 37 if ( ! is_array( $this->choices ) ) { 38 $this->choices = array(); 39 } 40 41 $l10n = Kirki_l10n::get_strings( $this->kirki_config ); 42 43 if ( ! isset( $this->choices['on'] ) ) { 44 $this->choices['on'] = $l10n['on']; 45 } 46 47 if ( ! isset( $this->choices['off'] ) ) { 48 $this->choices['off'] = $l10n['off']; 49 } 50 51 if ( ! isset( $this->choices['round'] ) ) { 52 $this->choices['round'] = false; 53 } 54 55 } 56 } 57 }