| @@ -56,11 +56,11 @@ | ||
| 56 | 56 | $empty_value = __('Selecte', 'wpdirectorykit').' '.$field_label; |
| 57 | 57 | $button_suffix = ''; |
| 58 | 58 | |
| 59 | 59 | //var_dump($values); |
| 60 | -wp_enqueue_script('select2'); | |
| 60 | +wp_enqueue_script('select2-select2'); | |
| 61 | 61 | wp_enqueue_script('wdk-select2'); |
| 62 | -wp_enqueue_style('select2'); | |
| 62 | +wp_enqueue_style('select2-select2'); | |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | $post_values = wmvc_show_data($field_id, $db_data, ''); |
| 66 | 66 | $post_values = explode(',', $post_values); |
| @@ -65,20 +65,53 @@ | ||
| 65 | 65 | $post_values = wmvc_show_data($field_id, $db_data, ''); |
| 66 | 66 | $post_values = explode(',', $post_values); |
| 67 | 67 | ?> |
| 68 | 68 | |
| 69 | -<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); ?>"> | |
| 69 | +<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;?>"> | |
| 70 | 70 | <label for="<?php echo esc_attr($field_id); ?>"><?php echo esc_html($field_label).esc_html($required); ?></label> |
| 71 | 71 | <div class="wdk-field-container"> |
| 72 | - <?php echo wdk_select_option_multiple($field_id.'_select2', $values, $post_values, "id='".$field_id."_select2' class='select_multi' data-maxselectlimit='20' data-placeholder='".esc_attr($empty_value)."'"); ?> | |
| 72 | + <?php | |
| 73 | + echo wp_kses( | |
| 74 | + wdk_select_option_multiple( | |
| 75 | + $field_id.'_select2', | |
| 76 | + $values, | |
| 77 | + $post_values, | |
| 78 | + "id='".$field_id."_select2' class='select_multi' data-maxselectlimit='20' data-placeholder='".esc_attr($empty_value)."'" | |
| 79 | + ), | |
| 80 | + [ | |
| 81 | + 'select' => [ | |
| 82 | + 'id' => true, | |
| 83 | + 'class' => true, | |
| 84 | + 'data-maxselectlimit' => true, | |
| 85 | + 'data-placeholder' => true, | |
| 86 | + 'multiple' => true, | |
| 87 | + 'name' => true, | |
| 88 | + ], | |
| 89 | + 'option' => [ | |
| 90 | + 'value' => true, | |
| 91 | + 'selected' => true, | |
| 92 | + ], | |
| 93 | + ] | |
| 94 | + ); | |
| 95 | + ?> | |
| 96 | + | |
| 73 | 97 | <span class="suffix"><?php |
| 74 | - echo esc_html($field->prefix); | |
| 98 | + // Dynamic field values are registered in the translation catalog separately. | |
| 99 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 100 | + echo esc_html__($field->prefix, 'wpdirectorykit'); | |
| 75 | 101 | if(!empty($field->prefix) && !empty($field->suffix)) echo ' / '; |
| 76 | - echo esc_html($field->suffix); | |
| 102 | + // Dynamic field values are registered in the translation catalog separately. | |
| 103 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 104 | + echo esc_html__($field->suffix, 'wpdirectorykit'); | |
| 77 | 105 | ?></span> |
| 78 | 106 | <?php if(!empty($field->hint)):?> |
| 79 | 107 | <p class="wdk-hint"> |
| 80 | 108 | <?php echo esc_html($field->hint); ?> |
| 109 | + </p> | |
| 110 | + <?php endif;?> | |
| 111 | + <?php if(!empty($form) && method_exists($form, 'hasError') && $form->getError($field_id)):?> | |
| 112 | + <p class="wdk-hint wdk-error"> | |
| 113 | + <?php echo wp_kses_post($form->getError($field_id)); ?> | |
| 81 | 114 | </p> |
| 82 | 115 | <?php endif;?> |
| 83 | 116 | <input type="hidden" name="<?php echo esc_attr($field_id);?>" id="<?php echo esc_attr($field_id);?>" value="<?php echo esc_attr(wmvc_show_data($field_id, $db_data, '')); ?>"/> |
| 84 | 117 | </div> |