|
@@ 598-638 (lines=41) @@
|
| 595 |
|
* @since 1.0.0 |
| 596 |
|
* @return string |
| 597 |
|
*/ |
| 598 |
|
public function generate_select_html( $key, $data ) { |
| 599 |
|
$field = $this->get_field_key( $key ); |
| 600 |
|
$defaults = array( |
| 601 |
|
'title' => '', |
| 602 |
|
'disabled' => false, |
| 603 |
|
'class' => '', |
| 604 |
|
'css' => '', |
| 605 |
|
'placeholder' => '', |
| 606 |
|
'type' => 'text', |
| 607 |
|
'desc_tip' => false, |
| 608 |
|
'description' => '', |
| 609 |
|
'custom_attributes' => array(), |
| 610 |
|
'options' => array() |
| 611 |
|
); |
| 612 |
|
|
| 613 |
|
$data = wp_parse_args( $data, $defaults ); |
| 614 |
|
|
| 615 |
|
ob_start(); |
| 616 |
|
?> |
| 617 |
|
<tr valign="top"> |
| 618 |
|
<th scope="row" class="titledesc"> |
| 619 |
|
<label for="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label> |
| 620 |
|
<?php echo $this->get_tooltip_html( $data ); ?> |
| 621 |
|
</th> |
| 622 |
|
<td class="forminp"> |
| 623 |
|
<fieldset> |
| 624 |
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> |
| 625 |
|
<select class="select <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field ); ?>" id="<?php echo esc_attr( $field ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?>> |
| 626 |
|
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?> |
| 627 |
|
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, esc_attr( $this->get_option( $key ) ) ); ?>><?php echo esc_attr( $option_value ); ?></option> |
| 628 |
|
<?php endforeach; ?> |
| 629 |
|
</select> |
| 630 |
|
<?php echo $this->get_description_html( $data ); ?> |
| 631 |
|
</fieldset> |
| 632 |
|
</td> |
| 633 |
|
</tr> |
| 634 |
|
<?php |
| 635 |
|
|
| 636 |
|
return ob_get_clean(); |
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
/** |
| 640 |
|
* Generate Multiselect HTML. |
| 641 |
|
* |
|
@@ 647-688 (lines=42) @@
|
| 644 |
|
* @since 1.0.0 |
| 645 |
|
* @return string |
| 646 |
|
*/ |
| 647 |
|
public function generate_multiselect_html( $key, $data ) { |
| 648 |
|
$field = $this->get_field_key( $key ); |
| 649 |
|
$defaults = array( |
| 650 |
|
'title' => '', |
| 651 |
|
'disabled' => false, |
| 652 |
|
'class' => '', |
| 653 |
|
'css' => '', |
| 654 |
|
'placeholder' => '', |
| 655 |
|
'type' => 'text', |
| 656 |
|
'desc_tip' => false, |
| 657 |
|
'description' => '', |
| 658 |
|
'custom_attributes' => array(), |
| 659 |
|
'options' => array() |
| 660 |
|
); |
| 661 |
|
|
| 662 |
|
$data = wp_parse_args( $data, $defaults ); |
| 663 |
|
$value = (array) $this->get_option( $key, array() ); |
| 664 |
|
|
| 665 |
|
ob_start(); |
| 666 |
|
?> |
| 667 |
|
<tr valign="top"> |
| 668 |
|
<th scope="row" class="titledesc"> |
| 669 |
|
<label for="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label> |
| 670 |
|
<?php echo $this->get_tooltip_html( $data ); ?> |
| 671 |
|
</th> |
| 672 |
|
<td class="forminp"> |
| 673 |
|
<fieldset> |
| 674 |
|
<legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> |
| 675 |
|
<select multiple="multiple" class="multiselect <?php echo esc_attr( $data['class'] ); ?>" name="<?php echo esc_attr( $field ); ?>[]" id="<?php echo esc_attr( $field ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>" <?php disabled( $data['disabled'], true ); ?> <?php echo $this->get_custom_attribute_html( $data ); ?>> |
| 676 |
|
<?php foreach ( (array) $data['options'] as $option_key => $option_value ) : ?> |
| 677 |
|
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( in_array( $option_key, $value ), true ); ?>><?php echo esc_attr( $option_value ); ?></option> |
| 678 |
|
<?php endforeach; ?> |
| 679 |
|
</select> |
| 680 |
|
<?php echo $this->get_description_html( $data ); ?> |
| 681 |
|
</fieldset> |
| 682 |
|
</td> |
| 683 |
|
</tr> |
| 684 |
|
<?php |
| 685 |
|
|
| 686 |
|
return ob_get_clean(); |
| 687 |
|
} |
| 688 |
|
|
| 689 |
|
/** |
| 690 |
|
* Generate Title HTML. |
| 691 |
|
* |