jetpack
/
jetpack_vendor
/
automattic
/
jetpack-search
/
src
/
customizer
/
customize-controls
/
class-label-control.php
jetpack
/
jetpack_vendor
/
automattic
/
jetpack-search
/
src
/
customizer
/
customize-controls
Last commit date
class-excluded-post-types-control.css
9 months ago
class-excluded-post-types-control.php
9 months ago
class-label-control.php
4 years ago
customize-controls.css
4 years ago
class-label-control.php
46 lines
| 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 | namespace Automattic\Jetpack\Search; |
| 10 | |
| 11 | use WP_Customize_Control; |
| 12 | |
| 13 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
| 14 | return; |
| 15 | } |
| 16 | /** |
| 17 | * Label Control class. |
| 18 | */ |
| 19 | class Label_Control extends WP_Customize_Control { |
| 20 | /** |
| 21 | * Override rendering for custom class name; omit element ID. |
| 22 | */ |
| 23 | protected function render() { |
| 24 | echo '<li class="customize-control customize-label-control">'; |
| 25 | $this->render_content(); |
| 26 | echo '</li>'; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Override content rendering. |
| 31 | */ |
| 32 | protected function render_content() { |
| 33 | if ( ! empty( $this->label ) ) : ?> |
| 34 | <label class="customize-control-title"> |
| 35 | <?php echo esc_html( $this->label ); ?> |
| 36 | </label> |
| 37 | <?php endif; ?> |
| 38 | <?php if ( ! empty( $this->description ) ) : ?> |
| 39 | <span class="description customize-control-description"> |
| 40 | <?php echo esc_html( $this->description ); ?> |
| 41 | </span> |
| 42 | <?php |
| 43 | endif; |
| 44 | } |
| 45 | } |
| 46 |