diff --git src/wp-includes/class-wp-customize-control.php src/wp-includes/class-wp-customize-control.php
index a0abfc5..f1f41eb 100644
|
|
|
class WP_Customize_Control { |
| 404 | 404 | * @since 3.4.0 |
| 405 | 405 | */ |
| 406 | 406 | protected function render_content() { |
| | 407 | $input_id = '_customize-input-' . $this->id; |
| | 408 | $description_id = '_customize-description-' . $this->id; |
| | 409 | $describedby = ( ! empty( $this->description ) ) ? 'aria-describedby="' . esc_attr( $description_id ). '"' : ''; |
| | 410 | |
| 407 | 411 | switch( $this->type ) { |
| 408 | 412 | case 'checkbox': |
| 409 | 413 | ?> |
| 410 | | <label> |
| 411 | | <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> /> |
| | 414 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
| | 415 | <input id="<?php echo esc_attr( $input_id ); ?>" type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> <?php echo $describedby; ?> /> |
| 412 | 416 | <?php echo esc_html( $this->label ); ?> |
| 413 | | <?php if ( ! empty( $this->description ) ) : ?> |
| 414 | | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
| 415 | | <?php endif; ?> |
| 416 | 417 | </label> |
| 417 | | <?php |
| | 418 | <?php if ( ! empty( $this->description ) ) : ?> |
| | 419 | <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
| | 420 | <?php endif; |
| 418 | 421 | break; |
| 419 | 422 | case 'radio': |
| 420 | 423 | if ( empty( $this->choices ) ) |
| … |
… |
class WP_Customize_Control { |
| 439 | 442 | endforeach; |
| 440 | 443 | break; |
| 441 | 444 | case 'select': |
| 442 | | if ( empty( $this->choices ) ) |
| | 445 | if ( empty( $this->choices ) ) { |
| 443 | 446 | return; |
| 444 | | |
| | 447 | } |
| 445 | 448 | ?> |
| 446 | | <label> |
| 447 | | <?php if ( ! empty( $this->label ) ) : ?> |
| | 449 | |
| | 450 | <?php if ( ! empty( $this->label ) ) : ?> |
| | 451 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
| 448 | 452 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 449 | | <?php endif; |
| 450 | | if ( ! empty( $this->description ) ) : ?> |
| 451 | | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
| 452 | | <?php endif; ?> |
| 453 | | |
| 454 | | <select <?php $this->link(); ?>> |
| 455 | | <?php |
| 456 | | foreach ( $this->choices as $value => $label ) |
| 457 | | echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
| 458 | | ?> |
| 459 | | </select> |
| 460 | | </label> |
| | 453 | </label> |
| | 454 | <?php endif; |
| | 455 | if ( ! empty( $this->description ) ) : ?> |
| | 456 | <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
| | 457 | <?php endif; ?> |
| | 458 | |
| | 459 | <select id="<?php echo esc_attr( $input_id ); ?>" <?php $this->link(); ?> <?php echo $describedby; ?>> |
| | 460 | <?php |
| | 461 | foreach ( $this->choices as $value => $label ) |
| | 462 | echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
| | 463 | ?> |
| | 464 | </select> |
| | 465 | |
| 461 | 466 | <?php |
| 462 | 467 | break; |
| 463 | 468 | case 'textarea': |
| 464 | 469 | ?> |
| 465 | | <label> |
| 466 | | <?php if ( ! empty( $this->label ) ) : ?> |
| | 470 | |
| | 471 | <?php if ( ! empty( $this->label ) ) : ?> |
| | 472 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
| 467 | 473 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 468 | | <?php endif; |
| 469 | | if ( ! empty( $this->description ) ) : ?> |
| 470 | | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
| 471 | | <?php endif; ?> |
| 472 | | <textarea rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea> |
| 473 | | </label> |
| | 474 | </label> |
| | 475 | <?php endif; |
| | 476 | if ( ! empty( $this->description ) ) : ?> |
| | 477 | <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
| | 478 | <?php endif; ?> |
| | 479 | <textarea id="<?php echo esc_attr( $input_id ); ?>" rows="5" <?php $this->link(); ?> <?php echo $describedby; ?>><?php echo esc_textarea( $this->value() ); ?></textarea> |
| | 480 | |
| 474 | 481 | <?php |
| 475 | 482 | break; |
| 476 | 483 | case 'dropdown-pages': |
| 477 | 484 | ?> |
| 478 | | <label> |
| | 485 | |
| 479 | 486 | <?php if ( ! empty( $this->label ) ) : ?> |
| 480 | | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| | 487 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
| | 488 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| | 489 | </label> |
| 481 | 490 | <?php endif; |
| 482 | 491 | if ( ! empty( $this->description ) ) : ?> |
| 483 | | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
| | 492 | <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
| 484 | 493 | <?php endif; ?> |
| 485 | 494 | |
| 486 | 495 | <?php $dropdown = wp_dropdown_pages( |
| … |
… |
class WP_Customize_Control { |
| 495 | 504 | |
| 496 | 505 | // Hackily add in the data link parameter. |
| 497 | 506 | $dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown ); |
| | 507 | // Hackily add in the ID and aria-describedby parameters. |
| | 508 | $dropdown = str_replace( '<select', '<select id="' . esc_attr( $input_id ) . '" ' . $describedby, $dropdown ); |
| 498 | 509 | echo $dropdown; |
| 499 | | ?> |
| 500 | | </label> |
| 501 | | <?php |
| | 510 | |
| 502 | 511 | break; |
| 503 | 512 | default: |
| 504 | 513 | ?> |
| 505 | | <label> |
| 506 | | <?php if ( ! empty( $this->label ) ) : ?> |
| | 514 | |
| | 515 | <?php if ( ! empty( $this->label ) ) : ?> |
| | 516 | <label for="<?php echo esc_attr( $input_id ); ?>"> |
| 507 | 517 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 508 | | <?php endif; |
| 509 | | if ( ! empty( $this->description ) ) : ?> |
| 510 | | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
| 511 | | <?php endif; ?> |
| 512 | | <input type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> /> |
| 513 | | </label> |
| | 518 | </label> |
| | 519 | <?php endif; |
| | 520 | if ( ! empty( $this->description ) ) : ?> |
| | 521 | <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
| | 522 | <?php endif; ?> |
| | 523 | <input id="<?php echo esc_attr( $input_id ); ?>" type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> <?php echo $describedby; ?> /> |
| 514 | 524 | <?php |
| 515 | 525 | break; |
| 516 | 526 | } |