action-button.php
3 years ago
calculated-field.php
3 years ago
checkbox-field.php
3 years ago
color-picker-field.php
3 years ago
date-field.php
3 years ago
datetime-field.php
3 years ago
form-break-field.php
3 years ago
group-break-field.php
3 years ago
heading-field.php
3 years ago
hidden-field.php
3 years ago
image-preview.php
3 years ago
map-field.php
3 years ago
media-field.php
3 years ago
number-field.php
3 years ago
preset-media-field.php
3 years ago
progress-bar.php
3 years ago
radio-field.php
3 years ago
range-field.php
3 years ago
select-field.php
3 years ago
text-field.php
3 years ago
textarea-field.php
3 years ago
time-field.php
3 years ago
wysiwyg-field.php
3 years ago
datetime-field.php
41 lines
| 1 | <?php |
| 2 | /** |
| 3 | * input[type="hidden"] template |
| 4 | * @var \Jet_Form_Builder\Blocks\Render\Datetime_Field_Render $this |
| 5 | */ |
| 6 | |
| 7 | use Jet_Form_Builder\Classes\Regexp_Tools; |
| 8 | use Jet_Form_Builder\Classes\Date_Tools; |
| 9 | |
| 10 | $this->set_value(); |
| 11 | $this->add_attribute( 'class', 'jet-form-builder__field datetime-field' ); |
| 12 | $this->add_attribute( 'class', $args['class_name'] ); |
| 13 | $this->add_attribute( 'required', $this->block_type->get_required_val() ); |
| 14 | $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) ); |
| 15 | $this->add_attribute( 'type', 'datetime-local' ); |
| 16 | $this->add_attribute( 'data-field-name', $args['name'] ); |
| 17 | $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) ); |
| 18 | $this->add_attribute( 'data-jfb-sync' ); |
| 19 | |
| 20 | if ( Regexp_Tools::has_macro( $this->args['min'] ) ) { |
| 21 | wp_enqueue_script( \Jet_Form_Builder\Blocks\Dynamic_Value::HANDLE ); |
| 22 | $this->add_attribute( 'data-min', $this->args['min'] ); |
| 23 | } else { |
| 24 | $this->add_attribute( |
| 25 | 'min', |
| 26 | Date_Tools::time_to_string( $this->args['min'], Date_Tools::DATETIME ) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | if ( Regexp_Tools::has_macro( $this->args['max'] ) ) { |
| 31 | wp_enqueue_script( \Jet_Form_Builder\Blocks\Dynamic_Value::HANDLE ); |
| 32 | $this->add_attribute( 'data-max', $this->args['max'] ); |
| 33 | } else { |
| 34 | $this->add_attribute( |
| 35 | 'max', |
| 36 | Date_Tools::time_to_string( $this->args['max'], Date_Tools::DATETIME ) |
| 37 | ); |
| 38 | } |
| 39 | ?> |
| 40 | <input <?php $this->render_attributes_string(); ?>> |
| 41 |