wysiwyg.php 1.6 KB

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