section.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace Elementor;
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit; // Exit if accessed directly.
  5. }
  6. /**
  7. * Elementor section control.
  8. *
  9. * A base control for creating section control. Displays a header that
  10. * functions as a toggle to show or hide a set of controls.
  11. *
  12. * Note: Do not use it directly, instead use `$widget->start_controls_section()`
  13. * and `$widget->end_controls_section()` to wrap a set of controls.
  14. *
  15. * @since 1.0.0
  16. */
  17. class Control_Section extends Base_UI_Control {
  18. /**
  19. * Get section control type.
  20. *
  21. * Retrieve the control type, in this case `section`.
  22. *
  23. * @since 1.0.0
  24. * @access public
  25. *
  26. * @return string Control type.
  27. */
  28. public function get_type() {
  29. return 'section';
  30. }
  31. /**
  32. * Render section control output in the editor.
  33. *
  34. * Used to generate the control HTML in the editor using Underscore JS
  35. * template. The variables for the class are available using `data` JS
  36. * object.
  37. *
  38. * @since 1.0.0
  39. * @access public
  40. */
  41. public function content_template() {
  42. ?>
  43. <div class="elementor-panel-heading">
  44. <div class="elementor-panel-heading-toggle elementor-section-toggle" data-collapse_id="{{ data.name }}">
  45. <i class="fa" aria-hidden="true"></i>
  46. </div>
  47. <div class="elementor-panel-heading-title elementor-section-title">{{{ data.label }}}</div>
  48. </div>
  49. <?php
  50. }
  51. /**
  52. * Get repeater control default settings.
  53. *
  54. * Retrieve the default settings of the repeater control. Used to return the
  55. * default settings while initializing the repeater control.
  56. *
  57. * @since 1.0.0
  58. * @access protected
  59. *
  60. * @return array Control default settings.
  61. */
  62. protected function get_default_settings() {
  63. return [
  64. 'separator' => 'none',
  65. ];
  66. }
  67. }