divider.php 1.3 KB

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