forked from gambitph/Titan-Framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
class-option-editor.php
48 lines (39 loc) · 1.17 KB
/
class-option-editor.php
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
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class TitanFrameworkOptionEditor extends TitanFrameworkOption {
public $defaultSecondarySettings = array(
'wpautop' => true,
'media_buttons' => true,
'rows' => 10,
);
/*
* Display for options and meta
*/
public function display() {
$this->echoOptionHeader();
wp_editor( $this->getValue(), $this->getID(), array(
'wpautop' => $this->settings['wpautop'],
'media_buttons' => $this->settings['media_buttons'],
'textarea_rows' => $this->settings['rows'],
) );
$this->echoOptionFooter();
}
public function cleanValueForGetting( $value ) {
if ( $this->settings['wpautop'] ) {
return wpautop( stripslashes( $value ) );
}
return stripslashes( $value );
}
/*
* Display for theme customizer
*/
public function registerCustomizerControl( $wp_customize, $section, $priority = 1 ) {
$wp_customize->add_control( new TitanFrameworkCustomizeControl( $wp_customize, $this->getID(), array(
'label' => $this->settings['name'],
'section' => $section->settings['id'],
'settings' => $this->getID(),
'description' => $this->settings['desc'],
'priority' => $priority,
) ) );
}
}