| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || die(); |
| 4 |
|
| 5 |
class Sellkit_Elementor_Optin_Field_Number extends Sellkit_Elementor_Optin_Field_Text { |
| 6 |
|
| 7 |
public static function get_field_type() { |
| 8 |
return 'number'; |
| 9 |
} |
| 10 |
|
| 11 |
public function get_input_type() { |
| 12 |
return 'number'; |
| 13 |
} |
| 14 |
|
| 15 |
public function add_field_render_attribute() { |
| 16 |
parent::add_field_render_attribute(); |
| 17 |
|
| 18 |
if ( ! empty( $this->field['min'] ) ) { |
| 19 |
$this->widget->add_render_attribute( 'field-' . $this->get_id(), 'min', $this->field['min'] ); |
| 20 |
} |
| 21 |
|
| 22 |
if ( ! empty( $this->field['max'] ) ) { |
| 23 |
$this->widget->add_render_attribute( 'field-' . $this->get_id(), 'max', $this->field['max'] ); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
public static function get_additional_controls() { |
| 28 |
$commons = parent::get_common_controls(); |
| 29 |
|
| 30 |
return [ |
| 31 |
'label' => $commons['label'], |
| 32 |
'field_value' => $commons['field_value'], |
| 33 |
'placeholder' => $commons['placeholder'], |
| 34 |
'min' => [ |
| 35 |
'label' => esc_html__( 'Min Value', 'sellkit' ), |
| 36 |
'type' => 'number', |
| 37 |
'conditions' => [ 'terms' => [ parent::get_type_condition() ] ], |
| 38 |
], |
| 39 |
'max' => [ |
| 40 |
'label' => esc_html__( 'Max Value', 'sellkit' ), |
| 41 |
'type' => 'number', |
| 42 |
'conditions' => [ 'terms' => [ parent::get_type_condition() ] ], |
| 43 |
], |
| 44 |
'required' => $commons['required'], |
| 45 |
'width_responsive' => $commons['width_responsive'], |
| 46 |
]; |
| 47 |
} |
| 48 |
} |
| 49 |
|