PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / customizer / packages / controls / editor / src / Control / Editor.php
kirki / customizer / packages / controls / editor / src / Control Last commit date
Editor.php 3 months ago
Editor.php
100 lines
1 <?php
2 /**
3 * Customizer Control: editor.
4 *
5 * Creates a TinyMCE textarea.
6 *
7 * @package kirki-framework/control-editor
8 * @copyright Copyright (c) 2023, Themeum
9 * @license https://opensource.org/licenses/MIT
10 * @since 1.0
11 */
12
13 namespace Kirki\Control;
14
15 use Kirki\Control\Base;
16 use Kirki\URL;
17
18 /**
19 * A TinyMCE control.
20 *
21 * @since 1.0
22 */
23 class Editor extends Base {
24
25 /**
26 * The control type.
27 *
28 * @access public
29 * @since 1.0
30 * @var string
31 */
32 public $type = 'kirki-editor';
33
34 /**
35 * The version. Used in scripts & styles for cache-busting.
36 *
37 * @static
38 * @access public
39 * @since 1.0
40 * @var string
41 */
42 public static $control_ver = '1.0';
43
44 /**
45 * Args to pass to TinyMCE.
46 *
47 * @access public
48 * @since 1.0
49 * @var bool
50 */
51 public $choices = [];
52
53 /**
54 * Enqueue control related scripts/styles.
55 *
56 * @access public
57 * @since 1.0
58 * @return void
59 */
60
61
62 /**
63 * Refresh the parameters passed to the JavaScript via JSON.
64 *
65 * @access public
66 * @since 1.0
67 * @return void
68 */
69 public function to_json() {
70 parent::to_json();
71 $this->json['choices'] = $this->choices;
72 }
73
74 /**
75 * An Underscore (JS) template for this control's content (but not its container).
76 *
77 * Class variables for this control class are available in the `data` JS object;
78 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
79 *
80 * The actual editor is added from the \Kirki\Field\Editor class.
81 * All this template contains is a button that triggers the global editor on/off
82 * and a hidden textarea element that is used to mirror save the options.
83 *
84 * @see WP_Customize_Control::print_template()
85 *
86 * @access protected
87 * @since 1.0
88 * @return void
89 */
90 protected function content_template() {
91 ?>
92 <label>
93 <# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
94 <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
95 </label>
96 <textarea id="kirki-editor-{{{ data.id.replace( '[', '' ).replace( ']', '' ) }}}" {{{ data.inputAttrs }}} {{{ data.link }}}>{{ data.value }}</textarea>
97 <?php
98 }
99 }
100