tab.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Elementor;
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit; // Exit if accessed directly.
  5. }
  6. /**
  7. * Elementor tab control.
  8. *
  9. * A base control for creating tab control. Displays a tab header for a set of
  10. * controls.
  11. *
  12. * Note: Do not use it directly, instead use: `$widget->start_controls_tab()`
  13. * and in the end `$widget->end_controls_tab()`.
  14. *
  15. * @since 1.0.0
  16. */
  17. class Control_Tab extends Base_UI_Control {
  18. /**
  19. * Get tab control type.
  20. *
  21. * Retrieve the control type, in this case `tab`.
  22. *
  23. * @since 1.0.0
  24. * @access public
  25. *
  26. * @return string Control type.
  27. */
  28. public function get_type() {
  29. return 'tab';
  30. }
  31. /**
  32. * Render tab 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-tab-heading">
  44. {{{ data.label }}}
  45. </div>
  46. <?php
  47. }
  48. /**
  49. * Get tab control default settings.
  50. *
  51. * Retrieve the default settings of the tab control. Used to return the
  52. * default settings while initializing the tab control.
  53. *
  54. * @since 1.0.0
  55. * @access protected
  56. *
  57. * @return array Control default settings.
  58. */
  59. protected function get_default_settings() {
  60. return [
  61. 'separator' => 'none',
  62. ];
  63. }
  64. }