Нет описания

class-label-control.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * A label-only Customizer control for use with Jetpack Search configuration
  4. *
  5. * @package automattic/jetpack
  6. * @since 8.6.0
  7. */
  8. /**
  9. * Label Control class.
  10. */
  11. class Label_Control extends WP_Customize_Control {
  12. /**
  13. * Enqueue styles related to this control.
  14. */
  15. public function enqueue() {
  16. require_once dirname( __DIR__ ) . '/class.jetpack-search-helpers.php';
  17. $style_relative_path = 'modules/search/customize-controls/class-label-control.css';
  18. $style_version = Jetpack_Search_Helpers::get_asset_version( $style_relative_path );
  19. $style_path = plugins_url( $style_relative_path, JETPACK__PLUGIN_FILE );
  20. wp_enqueue_style( 'jetpack-instant-search-customizer-label', $style_path, array( 'customize-controls' ), $style_version );
  21. }
  22. /**
  23. * Override rendering for custom class name; omit element ID.
  24. */
  25. protected function render() {
  26. echo '<li class="customize-control customize-label-control">';
  27. $this->render_content();
  28. echo '</li>';
  29. }
  30. /**
  31. * Override content rendering.
  32. */
  33. protected function render_content() {
  34. if ( ! empty( $this->label ) ) : ?>
  35. <label class="customize-control-title">
  36. <?php echo esc_html( $this->label ); ?>
  37. </label>
  38. <?php endif; ?>
  39. <?php if ( ! empty( $this->description ) ) : ?>
  40. <span class="description customize-control-description">
  41. <?php echo esc_html( $this->description ); ?>
  42. </span>
  43. <?php
  44. endif;
  45. }
  46. }