lightspeeddevelopment /
lsx-customizer
| 1 | <?php |
||
| 2 | if ( ! class_exists( 'LSX_Customizer_Wysiwyg_Control' ) ) { |
||
| 3 | |||
| 4 | /** |
||
| 5 | * LSX Customizer Wysiwyg Control Class |
||
| 6 | * |
||
| 7 | * @package LSX Customizer |
||
| 8 | * @author LightSpeed |
||
| 9 | * @license GPL3 |
||
| 10 | * @link |
||
| 11 | * @copyright 2016 LightSpeed |
||
| 12 | */ |
||
| 13 | class LSX_Customizer_Wysiwyg_Control extends WP_Customize_Control { |
||
| 14 | |||
| 15 | public $type = 'wysiwyg'; |
||
|
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
Loading history...
|
|||
| 16 | |||
| 17 | /** |
||
| 18 | * Render the control's content. |
||
| 19 | * |
||
| 20 | * @since 1.1.1 |
||
| 21 | */ |
||
| 22 | public function render_content() { |
||
| 23 | ?> |
||
| 24 | <label> |
||
| 25 | <?php if ( ! empty( $this->label ) ) { ?> |
||
| 26 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
||
| 27 | <?php } ?> |
||
| 28 | <?php |
||
| 29 | $settings = array( |
||
| 30 | 'media_buttons' => false, |
||
| 31 | 'teeny' => true, |
||
| 32 | ); |
||
| 33 | |||
| 34 | $this->filter_editor_setting_link(); |
||
| 35 | wp_editor( $this->value(), $this->id, $settings ); |
||
| 36 | ?> |
||
| 37 | </label> |
||
| 38 | <?php |
||
| 39 | do_action( 'admin_footer' ); |
||
| 40 | do_action( 'admin_print_footer_scripts' ); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Filter editor setting link. |
||
| 45 | * |
||
| 46 | * @since 1.1.1 |
||
| 47 | */ |
||
| 48 | private function filter_editor_setting_link() { |
||
| 49 | add_filter( 'the_editor', function( $output ) { |
||
| 50 | return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); |
||
| 51 | } ); |
||
| 52 | } |
||
| 53 | |||
| 54 | } |
||
| 55 | |||
| 56 | } |
||
| 57 | |||
| 58 |