| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Elementor\Modules\Checkout\Fields; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
use Sellkit\Elementor\Modules\Checkout\Fields\Base; |
| 8 |
|
| 9 |
/** |
| 10 |
* Class multiselect. |
| 11 |
* |
| 12 |
* @since 1.1.0 |
| 13 |
*/ |
| 14 |
class Multiselect extends Base { |
| 15 |
/** |
| 16 |
* Type of field. |
| 17 |
* |
| 18 |
* @return string |
| 19 |
* @since 1.1.0 |
| 20 |
*/ |
| 21 |
public function type() { |
| 22 |
return 'multiselect'; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Adds additional class for fields if required |
| 27 |
* |
| 28 |
* @param array $args checkout fields options. |
| 29 |
* @param string $key field key. |
| 30 |
* @return array |
| 31 |
* @since 1.1.0 |
| 32 |
*/ |
| 33 |
protected function additional_class( $args, $key ) { |
| 34 |
$args['class'][] = 'sellkit-checkout-multiselect-wrapper'; |
| 35 |
return $args; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Customized html per field. |
| 40 |
* |
| 41 |
* @param string $field field html string. |
| 42 |
* @param array $args checkout fields options. |
| 43 |
* @param string $key key of field. |
| 44 |
* @return void |
| 45 |
* @since 1.1.0 |
| 46 |
*/ |
| 47 |
public function field( $field, $args, $key ) { |
| 48 |
?> |
| 49 |
<p> |
| 50 |
<span class="woocommerce-input-wrapper checkbox_wrapper"> |
| 51 |
<select multiple name="<?php echo esc_attr( $key ); ?>" > |
| 52 |
<?php foreach ( $args['options'] as $value => $label ) : ?> |
| 53 |
<option value="<?php echo esc_attr( $value ); ?>"><?php echo esc_html( $label ); ?></option> |
| 54 |
<?php endforeach; ?> |
| 55 |
</select> |
| 56 |
</span> |
| 57 |
</p> |
| 58 |
<?php |
| 59 |
} |
| 60 |
} |
| 61 |
|