button.php
2 weeks ago
form-end.php
2 weeks ago
form-field.php
2 weeks ago
form-label.php
2 weeks ago
form-start.php
2 weeks ago
header.php
2 weeks ago
input-checkbox.php
2 weeks ago
input-date-picker.php
2 weeks ago
input-hidden.php
2 weeks ago
input-image.php
2 weeks ago
input-number.php
2 weeks ago
input-radio.php
2 weeks ago
input-submit.php
2 weeks ago
input-text-multiple.php
2 weeks ago
input-text.php
2 weeks ago
input.php
2 weeks ago
noonce.php
2 weeks ago
paragraph.php
2 weeks ago
product-select.php
2 weeks ago
select.php
2 weeks ago
textarea.php
2 weeks ago
wyswig.php
2 weeks ago
input.php
113 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor; |
| 4 | |
| 5 | /** |
| 6 | * @var \WPDesk\Forms\Field $field |
| 7 | * @var string $name_prefix |
| 8 | * @var string $value |
| 9 | */ |
| 10 | if (!\in_array($field->get_type(), ['number', 'text', 'hidden'], \true)) { |
| 11 | ?> |
| 12 | <input type="hidden" name="<?php |
| 13 | echo \esc_attr($name_prefix) . '[' . \esc_attr($field->get_name()) . ']'; |
| 14 | ?>" value="no"/> |
| 15 | <?php |
| 16 | } |
| 17 | ?> |
| 18 | |
| 19 | <?php |
| 20 | if ($field->get_type() === 'checkbox' && $field->has_sublabel()) { |
| 21 | ?> |
| 22 | <label><?php |
| 23 | } |
| 24 | ?> |
| 25 | |
| 26 | <input |
| 27 | type="<?php |
| 28 | echo \esc_attr($field->get_type()); |
| 29 | ?>" |
| 30 | name="<?php |
| 31 | echo \esc_attr($name_prefix) . '[' . \esc_attr($field->get_name()) . ']'; |
| 32 | ?>" |
| 33 | id="<?php |
| 34 | echo \esc_attr($field->get_id()); |
| 35 | ?>" |
| 36 | |
| 37 | <?php |
| 38 | if ($field->has_classes()) { |
| 39 | ?> |
| 40 | class="<?php |
| 41 | echo \esc_attr($field->get_classes()); |
| 42 | ?>" |
| 43 | <?php |
| 44 | } |
| 45 | ?> |
| 46 | |
| 47 | <?php |
| 48 | if ($field->get_type() === 'text' && $field->has_placeholder()) { |
| 49 | ?> |
| 50 | placeholder="<?php |
| 51 | echo \esc_html($field->get_placeholder()); |
| 52 | ?>" |
| 53 | <?php |
| 54 | } |
| 55 | ?> |
| 56 | |
| 57 | <?php |
| 58 | foreach ($field->get_attributes() as $key => $atr_val) { |
| 59 | echo \esc_attr($key) . '="' . \esc_attr($atr_val) . '"'; |
| 60 | ?> |
| 61 | <?php |
| 62 | } |
| 63 | ?> |
| 64 | |
| 65 | <?php |
| 66 | if ($field->is_required()) { |
| 67 | ?> |
| 68 | required="required"<?php |
| 69 | } |
| 70 | ?> |
| 71 | <?php |
| 72 | if ($field->is_disabled()) { |
| 73 | ?> |
| 74 | disabled="disabled"<?php |
| 75 | } |
| 76 | ?> |
| 77 | <?php |
| 78 | if ($field->is_readonly()) { |
| 79 | ?> |
| 80 | readonly="readonly"<?php |
| 81 | } |
| 82 | ?> |
| 83 | <?php |
| 84 | if (\in_array($field->get_type(), ['number', 'text', 'hidden'], \true)) { |
| 85 | ?> |
| 86 | value="<?php |
| 87 | echo \esc_html($value); |
| 88 | ?>" |
| 89 | <?php |
| 90 | } else { |
| 91 | ?> |
| 92 | value="yes" |
| 93 | <?php |
| 94 | if ($value === 'yes') { |
| 95 | ?> |
| 96 | checked="checked" |
| 97 | <?php |
| 98 | } |
| 99 | ?> |
| 100 | <?php |
| 101 | } |
| 102 | ?> |
| 103 | /> |
| 104 | |
| 105 | <?php |
| 106 | if ($field->get_type() === 'checkbox' && $field->has_sublabel()) { |
| 107 | ?> |
| 108 | <?php |
| 109 | echo \esc_html($field->get_sublabel()); |
| 110 | ?></label> |
| 111 | <?php |
| 112 | } |
| 113 |