1 | <?php |
||
8 | class Rich_Text_Field extends Textarea_Field { |
||
9 | /** |
||
10 | * All Rich Text Fields settings references. |
||
11 | * Used to prevent duplicated wp_editor initialization with the same settings. |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | protected static $settings_references = []; |
||
16 | |||
17 | /** |
||
18 | * WP Editor settings |
||
19 | * |
||
20 | * @link https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/ |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $settings = array( |
||
24 | 'media_buttons' => true, |
||
25 | 'tinymce' => array( |
||
26 | 'resize' => true, |
||
27 | 'wp_autoresize_on' => true, |
||
28 | ), |
||
29 | ); |
||
30 | |||
31 | /** |
||
32 | * MD5 Hash of the instance settings |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $settings_hash = null; |
||
37 | |||
38 | /** |
||
39 | * WP Editor settings reference |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $settings_reference; |
||
44 | |||
45 | /** |
||
46 | * Set the editor settings |
||
47 | * |
||
48 | * @param array $settings |
||
49 | * @return self $this |
||
50 | */ |
||
51 | public function set_settings( $settings ) { |
||
56 | |||
57 | /** |
||
58 | * Calc the settings hash |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | protected function calc_settings_hash() { |
||
65 | |||
66 | /** |
||
67 | * Get the editor settings reference |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | protected function get_settings_reference() { |
||
78 | |||
79 | /** |
||
80 | * {@inheritDoc} |
||
81 | */ |
||
82 | public function activate() { |
||
87 | |||
88 | /** |
||
89 | * Display the editor. |
||
90 | * |
||
91 | * Instead of enqueueing all required scripts and stylesheets and setting up TinyMCE, |
||
92 | * wp_editor() automatically enqueues and sets up everything. |
||
93 | */ |
||
94 | public function editor_init() { |
||
110 | |||
111 | /** |
||
112 | * Display Upload Image Button |
||
113 | * |
||
114 | */ |
||
115 | public function upload_image_button_html() { |
||
121 | |||
122 | /** |
||
123 | * Returns an array that holds the field data, suitable for JSON representation. |
||
124 | * |
||
125 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
126 | * @return array |
||
127 | */ |
||
128 | public function to_json( $load ) { |
||
153 | } |