Generic.php
5 months ago
Number.php
5 months ago
Text.php
5 months ago
Textarea.php
5 months ago
URL.php
5 months ago
URL.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Override field methods |
| 4 | * |
| 5 | * @package kirki-framework/control-generic |
| 6 | * @copyright Copyright (c) 2023, Themeum |
| 7 | * @license https://opensource.org/licenses/MIT |
| 8 | * @since 1.0 |
| 9 | */ |
| 10 | |
| 11 | namespace Kirki\Field; |
| 12 | |
| 13 | /** |
| 14 | * Field overrides. |
| 15 | * |
| 16 | * @since 1.0 |
| 17 | */ |
| 18 | class URL extends Text { |
| 19 | |
| 20 | /** |
| 21 | * The field type. |
| 22 | * |
| 23 | * @access public |
| 24 | * @since 1.0 |
| 25 | * @var string |
| 26 | */ |
| 27 | public $type = 'kirki-url'; |
| 28 | |
| 29 | /** |
| 30 | * Filter arguments before creating the setting. |
| 31 | * |
| 32 | * @access public |
| 33 | * @since 0.1 |
| 34 | * @param array $args The field arguments. |
| 35 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
| 36 | * @return array |
| 37 | */ |
| 38 | public function filter_setting_args( $args, $wp_customize ) { |
| 39 | if ( $args['settings'] === $this->args['settings'] ) { |
| 40 | $args = parent::filter_setting_args( $args, $wp_customize ); |
| 41 | |
| 42 | // Set the sanitize-callback if none is defined. |
| 43 | if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
| 44 | $args['sanitize_callback'] = 'esc_url_raw'; |
| 45 | } |
| 46 | } |
| 47 | return $args; |
| 48 | } |
| 49 | } |
| 50 |