| @@ -32,8 +32,9 @@ | ||
| 32 | 32 | if(!isset($field->columns_number))$field->columns_number = ''; |
| 33 | 33 | if(!isset($field->prefix))$field->prefix = ''; |
| 34 | 34 | if(!isset($field->suffix))$field->suffix = ''; |
| 35 | 35 | if(!isset($field->default))$field->default = ''; |
| 36 | +if(!isset($field->empty_default))$field->empty_default = ''; | |
| 36 | 37 | |
| 37 | 38 | $required = ''; |
| 38 | 39 | if(isset($field->is_required) && $field->is_required == 1) |
| 39 | 40 | $required = '*'; |
| @@ -57,23 +58,50 @@ | ||
| 57 | 58 | //var_dump(wmvc_show_data($field_id, $db_data, '')); |
| 58 | 59 | |
| 59 | 60 | ?> |
| 60 | 61 | |
| 61 | -<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); ?>"> | |
| 62 | +<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;?>"> | |
| 62 | 63 | <label for="<?php echo esc_attr($field_id); ?>"><?php echo esc_html($field_label).esc_html($required); ?></label> |
| 63 | 64 | <div class="wdk-field-container"> |
| 64 | - <?php echo wmvc_select_option($field_id, $values, wmvc_show_data($field_id, $db_data, $field->default), "id='".$field_id."'"); ?> | |
| 65 | + <?php | |
| 66 | + echo wp_kses( | |
| 67 | + wmvc_select_option( | |
| 68 | + $field_id, | |
| 69 | + $values, | |
| 70 | + !empty(wmvc_show_data($field_id, $db_data, $field->default)) ? wmvc_show_data($field_id, $db_data, $field->default) : $field->empty_default, | |
| 71 | + "id='" . esc_attr($field_id) . "'" | |
| 72 | + ), | |
| 73 | + [ | |
| 74 | + 'select' => [ | |
| 75 | + 'id' => true, | |
| 76 | + 'name' => true, | |
| 77 | + ], | |
| 78 | + 'option' => [ | |
| 79 | + 'value' => true, | |
| 80 | + 'selected' => true, | |
| 81 | + ], | |
| 82 | + ] | |
| 83 | + ); | |
| 84 | + ?> | |
| 85 | + | |
| 65 | 86 | <span class="suffix"><?php |
| 66 | - echo esc_html($field->prefix); | |
| 87 | + // Dynamic field values are registered in the translation catalog separately. | |
| 88 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 89 | + echo esc_html__($field->prefix, 'wpdirectorykit'); | |
| 67 | 90 | if(!empty($field->prefix) && !empty($field->suffix)) echo ' / '; |
| 68 | - echo esc_html($field->suffix); | |
| 91 | + // Dynamic field values are registered in the translation catalog separately. | |
| 92 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 93 | + echo esc_html__($field->suffix, 'wpdirectorykit'); | |
| 69 | 94 | ?><?php if(($field_id=='wdk_listing_page' || $field_id=='wdk_results_page')):?> |
| 70 | 95 | <?php if(!empty(wmvc_show_data($field_id, $db_data, '')) && get_post_status(wmvc_show_data($field_id, $db_data, '')) == 'publish'):?> |
| 71 | - <a class="button button-primary" target="_blank" href="<?php echo get_permalink(wmvc_show_data($field_id, $db_data, ''));?>" style="margin-top: -5px;"> | |
| 96 | + <a class="button button-primary" target="_blank" href="<?php echo esc_url(get_permalink(wmvc_show_data($field_id, $db_data, '')));?>" style="margin-top: -5px;"> | |
| 72 | 97 | <?php echo esc_html__('View Page','wpdirectorykit');?> |
| 73 | 98 | </a> |
| 99 | + <a class="button button" target="_blank" href="<?php echo esc_url(admin_url('post.php?post='.wmvc_show_data($field_id, $db_data, '')).'&action=edit');?>" style="margin-top: -5px;"> | |
| 100 | + <span class="dashicons dashicons-edit" style="line-height: 29px;"></span> | |
| 101 | + </a> | |
| 74 | 102 | <?php else:?> |
| 75 | - <a class="button button-primary" target="_blank" href="<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=import_demo"; ?>" style="margin-top: -5px;"> | |
| 103 | + <a class="button button-primary" target="_blank" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_settings&function=import_demo"); ?>" style="margin-top: -5px;"> | |
| 76 | 104 | <?php echo esc_html__('Create Demo Page','wpdirectorykit');?> |
| 77 | 105 | </a> |
| 78 | 106 | <?php endif;?><?php endif;?></span> |
| 79 | 107 | <?php if(!empty($field->hint)):?> |
| @@ -78,8 +106,13 @@ | ||
| 78 | 106 | <?php endif;?><?php endif;?></span> |
| 79 | 107 | <?php if(!empty($field->hint)):?> |
| 80 | 108 | <p class="wdk-hint"> |
| 81 | 109 | <?php echo esc_html($field->hint); ?> |
| 110 | + </p> | |
| 111 | + <?php endif;?> | |
| 112 | + <?php if(!empty($form) && method_exists($form, 'hasError') && $form->getError($field_id)):?> | |
| 113 | + <p class="wdk-hint wdk-error"> | |
| 114 | + <?php echo wp_kses_post($form->getError($field_id)); ?> | |
| 82 | 115 | </p> |
| 83 | 116 | <?php endif;?> |
| 84 | 117 | </div> |
| 85 | 118 | </div> |