| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly. |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Elementor WYSIWYG control. |
| 12 |
* |
| 13 |
* A base control for creating WYSIWYG control. Displays a WordPress WYSIWYG |
| 14 |
* (TinyMCE) editor. |
| 15 |
* |
| 16 |
* @since 1.0.0 |
| 17 |
*/ |
| 18 |
class Control_Wysiwyg extends Base_Data_Control { |
| 19 |
|
| 20 |
/** |
| 21 |
* Get wysiwyg control type. |
| 22 |
* |
| 23 |
* Retrieve the control type, in this case `wysiwyg`. |
| 24 |
* |
| 25 |
* @since 1.0.0 |
| 26 |
* @access public |
| 27 |
* |
| 28 |
* @return string Control type. |
| 29 |
*/ |
| 30 |
public function get_type() { |
| 31 |
return 'wysiwyg'; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Render wysiwyg control output in the editor. |
| 36 |
* |
| 37 |
* Used to generate the control HTML in the editor using Underscore JS |
| 38 |
* template. The variables for the class are available using `data` JS |
| 39 |
* object. |
| 40 |
* |
| 41 |
* @since 1.0.0 |
| 42 |
* @access public |
| 43 |
*/ |
| 44 |
public function content_template() { |
| 45 |
?> |
| 46 |
<div class="elementor-control-field"> |
| 47 |
<div class="elementor-control-title">{{{ data.label }}}</div> |
| 48 |
<div class="elementor-control-input-wrapper elementor-control-tag-area"></div> |
| 49 |
</div> |
| 50 |
<# if ( data.description ) { #> |
| 51 |
<div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 52 |
<# } #> |
| 53 |
<?php |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Retrieve textarea control default settings. |
| 58 |
* |
| 59 |
* Get the default settings of the textarea control. Used to return the |
| 60 |
* default settings while initializing the textarea control. |
| 61 |
* |
| 62 |
* @since 2.0.0 |
| 63 |
* @access protected |
| 64 |
* |
| 65 |
* @return array Control default settings. |
| 66 |
*/ |
| 67 |
protected function get_default_settings() { |
| 68 |
return [ |
| 69 |
'label_block' => true, |
| 70 |
'ai' => [ |
| 71 |
'active' => true, |
| 72 |
'type' => 'textarea', |
| 73 |
], |
| 74 |
'dynamic' => [ |
| 75 |
'active' => true, |
| 76 |
'categories' => [ TagsModule::TEXT_CATEGORY ], |
| 77 |
], |
| 78 |
]; |
| 79 |
} |
| 80 |
} |
| 81 |
|