class-url.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Url control.
*
* @package Block_Lab
* @copyright Copyright(c) 2020, Block Lab
* @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0)
*/
namespace Block_Lab\Blocks\Controls;
/**
* Class Text
*/
class Url extends Control_Abstract {
/**
* Control name.
*
* @var string
*/
public $name = 'url';
/**
* Text constructor.
*
* @return void
*/
public function __construct() {
parent::__construct();
$this->label = __( 'URL', 'block-lab' );
}
/**
* Register settings.
*
* @return void
*/
public function register_settings() {
$this->settings[] = new Control_Setting( $this->settings_config['location'] );
$this->settings[] = new Control_Setting( $this->settings_config['width'] );
$this->settings[] = new Control_Setting( $this->settings_config['help'] );
$this->settings[] = new Control_Setting(
[
'name' => 'default',
'label' => __( 'Default Value', 'block-lab' ),
'type' => 'url',
'default' => '',
'sanitize' => 'esc_url_raw',
]
);
$this->settings[] = new Control_Setting( $this->settings_config['placeholder'] );
}
}