tutor-text-editor.php
26 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tutor text editor template |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage Global |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 2.0.0 |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * While loading template two args can be passed, $content is the default content to inside the editor |
| 14 | * and $args is for editor config. If args not passed then default args will be used from tutor_utils()->text_editor_config() here. |
| 15 | */ |
| 16 | $content = isset( $data['content'] ) ? $data['content'] : ''; |
| 17 | $args = isset( $data['args'] ) ? $data['args'] : array(); |
| 18 | ?> |
| 19 | <div class="tutor-text-editor-wrapper"> |
| 20 | <?php |
| 21 | $pattern = array( '/\<[\/]{0,1}div[^\>]*\>/i', '/<p>(?:\s| )*?<\/p>/i' ); |
| 22 | $content = preg_replace( $pattern, '', $content ); |
| 23 | wp_editor( $content, 'tutor-global-text-editor', is_array( $args ) && count( $args ) ? $args : tutor_utils()->text_editor_config() ); |
| 24 | ?> |
| 25 | </div> |
| 26 |