heading.php 1.3 KB

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