class-kirki-field-dashicons.php (958B)
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_Dashicons' ) ) { 13 14 /** 15 * Field overrides. 16 */ 17 class Kirki_Field_Dashicons extends Kirki_Field { 18 19 /** 20 * Sets the control type. 21 * 22 * @access protected 23 */ 24 protected function set_type() { 25 26 $this->type = 'kirki-dashicons'; 27 28 } 29 30 /** 31 * Sets the $sanitize_callback 32 * 33 * @access protected 34 */ 35 protected function set_sanitize_callback() { 36 37 // If a custom sanitize_callback has been defined, 38 // then we don't need to proceed any further. 39 if ( ! empty( $this->sanitize_callback ) ) { 40 return; 41 } 42 // Custom fields don't actually save any value. 43 // just use __return_true. 44 $this->sanitize_callback = 'esc_attr'; 45 46 } 47 } 48 }