No Description

section-pro.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Pro customizer section.
  4. *
  5. * @since 1.0.0
  6. * @access public
  7. */
  8. class xshop_pro_Customize_Section_Pro extends WP_Customize_Section {
  9. /**
  10. * The type of customize section being rendered.
  11. *
  12. * @since 1.0.0
  13. * @access public
  14. * @var string
  15. */
  16. public $type = 'xshop-pro';
  17. /**
  18. * Custom button text to output.
  19. *
  20. * @since 1.0.0
  21. * @access public
  22. * @var string
  23. */
  24. public $pro_text = '';
  25. /**
  26. * Custom pro button URL.
  27. *
  28. * @since 1.0.0
  29. * @access public
  30. * @var string
  31. */
  32. public $pro_url = '';
  33. /**
  34. * Add custom parameters to pass to the JS via JSON.
  35. *
  36. * @since 1.0.0
  37. * @access public
  38. * @return void
  39. */
  40. public function json() {
  41. $json = parent::json();
  42. $json['pro_text'] = $this->pro_text;
  43. $json['pro_url'] = esc_url( $this->pro_url );
  44. return $json;
  45. }
  46. /**
  47. * Outputs the Underscore.js template.
  48. *
  49. * @since 1.0.0
  50. * @access public
  51. * @return void
  52. */
  53. protected function render_template() { ?>
  54. <li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
  55. <h3 class="accordion-section-title">
  56. {{ data.title }}
  57. <# if ( data.pro_text && data.pro_url ) { #>
  58. <a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
  59. <# } #>
  60. </h3>
  61. </li>
  62. <?php }
  63. }