Shortcodes.php
991 Bytes
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
55
56
57
58
59
60
<?php
namespace ACP\Settings\Column;
use AC;
use AC\View;
class Shortcodes extends AC\Settings\Column {
/**
* @var string
*/
private $shortcode;
protected function define_options() {
return [ 'shortcode' ];
}
public function create_view() {
$setting = $this->create_element( 'select' )
->set_options( $this->get_shortcode_options() );
$view = new View( [
'label' => __( 'Shortcode', 'codepress-admin-columns' ),
'setting' => $setting,
] );
return $view;
}
/**
* @return array
*/
private function get_shortcode_options() {
global $shortcode_tags;
$shortcode_keys = array_keys( $shortcode_tags );
$options = array_combine( $shortcode_keys, $shortcode_keys );
asort( $options );
return $options;
}
/**
* @return string
*/
public function get_shortcode() {
return $this->shortcode;
}
/**
* @param string $shortcode
*/
public function set_shortcode( $shortcode ) {
$this->shortcode = $shortcode;
}
}