| @@ -27,8 +27,10 @@ | ||
| 27 | 27 | if(!isset($field->columns_number))$field->columns_number = ''; |
| 28 | 28 | if(!isset($field->prefix))$field->prefix = ''; |
| 29 | 29 | if(!isset($field->suffix))$field->suffix = ''; |
| 30 | 30 | if(!isset($field->class))$field->class = ''; |
| 31 | +if(!isset($field->default))$field->default = ''; | |
| 32 | +if(!isset($field->empty_default))$field->empty_default = ''; | |
| 31 | 33 | |
| 32 | 34 | $field_label = $field->field_label; |
| 33 | 35 | |
| 34 | 36 | $required = ''; |
| @@ -39,21 +41,37 @@ | ||
| 39 | 41 | $required = '*'; |
| 40 | 42 | |
| 41 | 43 | ?> |
| 42 | 44 | |
| 43 | -<div class="wdk-field-edit <?php echo esc_attr($field->field_type); ?> wdk-col-<?php echo esc_attr($field->columns_number); ?> <?php echo esc_attr($field->class); ?>"> | |
| 45 | +<div class="wdk-field-<?php echo esc_attr($field_id);?> wdk-field-edit <?php echo esc_attr($field->field_type); ?> wdk-col-<?php echo esc_attr($field->columns_number); ?> <?php echo esc_attr($field->class); ?> <?php echo esc_attr($field->class); ?> <?php if(!empty($form) && method_exists($form, 'hasError') && $form->hasError($field_id)):?> field-error <?php endif;?>"> | |
| 44 | 46 | <label for="<?php echo esc_attr($field_id); ?>"><?php echo esc_html($field_label).esc_html($required); ?></label> |
| 45 | 47 | <div class="wdk-field-container"> |
| 46 | - <input class="regular-text" name="<?php echo esc_attr($field_id); ?>" type="number" id="<?php echo esc_attr($field_id); ?>" value="<?php echo esc_attr(wdk_filter_decimal(wmvc_show_data($field_id, $db_data, ''))); ?>"> | |
| 48 | + <input min="<?php echo esc_attr(wmvc_show_data('min', $field, ''));?>" | |
| 49 | + max="<?php echo esc_attr(wmvc_show_data('max', $field, ''));?>" | |
| 50 | + step="<?php echo esc_attr(wmvc_show_data('pattern', $field, ''));?>" | |
| 51 | + pattern="<?php echo esc_attr(wmvc_show_data($field_id, $db_data, ''));?>" | |
| 52 | + class="regular-text" name="<?php echo esc_attr($field_id); ?>" | |
| 53 | + type="number" id="<?php echo esc_attr($field_id); ?>" | |
| 54 | + value="<?php echo esc_attr(wdk_filter_decimal(!empty(wmvc_show_data($field_id, $db_data, $field->default)) ? wmvc_show_data($field_id, $db_data, $field->default) : $field->empty_default)); ?>" | |
| 55 | + > | |
| 47 | 56 | <span class="suffix"><?php |
| 48 | - echo esc_html($field->prefix); | |
| 57 | + // Dynamic field values are registered in the translation catalog separately. | |
| 58 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 59 | + echo esc_html__($field->prefix, 'wpdirectorykit'); | |
| 49 | 60 | if(!empty($field->prefix) && !empty($field->suffix)) echo ' / '; |
| 50 | - echo esc_html($field->suffix); | |
| 61 | + // Dynamic field values are registered in the translation catalog separately. | |
| 62 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 63 | + echo esc_html__($field->suffix, 'wpdirectorykit'); | |
| 51 | 64 | ?></span> |
| 52 | 65 | |
| 53 | 66 | <?php if(!empty($field->hint)):?> |
| 54 | 67 | <p class="wdk-hint"> |
| 55 | 68 | <?php echo esc_html($field->hint); ?> |
| 69 | + </p> | |
| 70 | + <?php endif;?> | |
| 71 | + <?php if(!empty($form) && method_exists($form, 'hasError') && $form->getError($field_id)):?> | |
| 72 | + <p class="wdk-hint wdk-error"> | |
| 73 | + <?php echo wp_kses_post($form->getError($field_id)); ?> | |
| 56 | 74 | </p> |
| 57 | 75 | <?php endif;?> |
| 58 | 76 | </div> |
| 59 | 77 | </div> |