raw-html.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace Elementor;
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit; // Exit if accessed directly.
  5. }
  6. /**
  7. * Elementor raw HTML control.
  8. *
  9. * A base control for creating raw HTML control. Displays HTML markup between
  10. * controls in the panel.
  11. *
  12. * @since 1.0.0
  13. */
  14. class Control_Raw_Html extends Base_UI_Control {
  15. /**
  16. * Get raw html control type.
  17. *
  18. * Retrieve the control type, in this case `raw_html`.
  19. *
  20. * @since 1.0.0
  21. * @access public
  22. *
  23. * @return string Control type.
  24. */
  25. public function get_type() {
  26. return 'raw_html';
  27. }
  28. /**
  29. * Render raw html control output in the editor.
  30. *
  31. * Used to generate the control HTML in the editor using Underscore JS
  32. * template. The variables for the class are available using `data` JS
  33. * object.
  34. *
  35. * @since 1.0.0
  36. * @access public
  37. */
  38. public function content_template() {
  39. ?>
  40. <# if ( data.label ) { #>
  41. <span class="elementor-control-title">{{{ data.label }}}</span>
  42. <# } #>
  43. <div class="elementor-control-raw-html {{ data.content_classes }}">{{{ data.raw }}}</div>
  44. <?php
  45. }
  46. /**
  47. * Get raw html control default settings.
  48. *
  49. * Retrieve the default settings of the raw html control. Used to return the
  50. * default settings while initializing the raw html control.
  51. *
  52. * @since 1.0.0
  53. * @access protected
  54. *
  55. * @return array Control default settings.
  56. */
  57. protected function get_default_settings() {
  58. return [
  59. 'raw' => '',
  60. 'content_classes' => '',
  61. ];
  62. }
  63. }