| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The template for Edit Field. |
| 5 |
* |
| 6 |
* This is the template that form edit |
| 7 |
* |
| 8 |
*/ |
| 9 |
|
| 10 |
if (! defined('ABSPATH')) { |
| 11 |
exit; // Exit if accessed directly. |
| 12 |
} |
| 13 |
?> |
| 14 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 15 |
|
| 16 |
<div class="wrap wdk-wrap"> |
| 17 |
<h1 class="wp-heading-inline"><?php echo __('Fields Management', 'wpdirectorykit'); ?></h1> |
| 18 |
<br /><br /> |
| 19 |
<div class="wdk-body"> |
| 20 |
<div class="postbox" style="display: block;"> |
| 21 |
<div class="postbox-header"> |
| 22 |
<h3><?php echo __('Add/Edit Field', 'wpdirectorykit'); ?></h3> |
| 23 |
</div> |
| 24 |
<div class="inside"> |
| 25 |
|
| 26 |
<form method="post" class="form_listing_ai" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate"> |
| 27 |
|
| 28 |
<?php wp_nonce_field('wdk-fields-edit_' . wmvc_show_data('idfield', $db_data, 0), '_wpnonce'); ?> |
| 29 |
|
| 30 |
<?php |
| 31 |
$form->messages('class="alert alert-danger"', sprintf(__('Successfully saved, <a href="%1$s">Back to Fields Management </a>', 'wpdirectorykit'), admin_url('admin.php?page=wdk_fields'))); |
| 32 |
?> |
| 33 |
|
| 34 |
<table class="form-table" role="presentation"> |
| 35 |
<tbody> |
| 36 |
<?php if (wmvc_show_data('field_type', $db_data) != "SECTION"): ?> |
| 37 |
<tr> |
| 38 |
<th scope="row"> |
| 39 |
<label for="field_type"><?php echo __('Section', 'wpdirectorykit'); ?></label> |
| 40 |
</th> |
| 41 |
<td> |
| 42 |
<?php |
| 43 |
echo wmvc_select_option('section', $section_list, $selected_section); |
| 44 |
?> |
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
<?php endif; ?> |
| 48 |
<tr> |
| 49 |
<th scope="row"> |
| 50 |
<label for="field_type"><?php echo __('Field Type', 'wpdirectorykit'); ?></label> |
| 51 |
</th> |
| 52 |
<td> |
| 53 |
<?php |
| 54 |
echo wmvc_select_option('field_type', $field_types, wmvc_show_data('field_type', $db_data, '')); |
| 55 |
?> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
<tr> |
| 59 |
<th scope="row"> |
| 60 |
<label for="date_format"><?php echo __('Date format', 'wpdirectorykit'); ?></label> |
| 61 |
</th> |
| 62 |
<td> |
| 63 |
<input name="date_format" type="text" id="date_format" |
| 64 |
value="<?php echo esc_attr(wmvc_show_data('date_format', $db_data, '')); ?>" |
| 65 |
class="regular-text"> |
| 66 |
<p class="description" id="hint-description"> |
| 67 |
<?php echo __('Date Format for Front - End View', 'wpdirectorykit'); ?> |
| 68 |
</p> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
<tr> |
| 72 |
<th scope="row"> |
| 73 |
<label for="field_label"><?php echo __('Field Label', 'wpdirectorykit'); ?></label> |
| 74 |
</th> |
| 75 |
<td> |
| 76 |
<input name="field_label" type="text" id="field_label" |
| 77 |
value="<?php echo esc_attr(wmvc_show_data('field_label', $db_data, '')); ?>" |
| 78 |
class="regular-text"> |
| 79 |
|
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<th scope="row"><label for="hint"><?php echo __('Hint', 'wpdirectorykit'); ?></label> |
| 84 |
</th> |
| 85 |
<td> |
| 86 |
<input name="hint" type="text" id="hint" |
| 87 |
value="<?php echo esc_attr(wmvc_show_data('hint', $db_data, '')); ?>" |
| 88 |
class="regular-text"> |
| 89 |
<p class="description" id="hint-description"> |
| 90 |
<?php echo __('Hint is showing below fields like this one', 'wpdirectorykit'); ?> |
| 91 |
</p> |
| 92 |
</td> |
| 93 |
</tr> |
| 94 |
<tr> |
| 95 |
<th scope="row"><label for="placeholder"><?php echo __('Placeholder', 'wpdirectorykit'); ?></label> |
| 96 |
</th> |
| 97 |
<td> |
| 98 |
<input name="placeholder" type="text" id="placeholder" |
| 99 |
value="<?php echo esc_attr(wmvc_show_data('placeholder', $db_data, '')); ?>" |
| 100 |
class="regular-text"> |
| 101 |
<p class="description" id="placeholder-description"> |
| 102 |
<?php echo __('Placeholder is showing on placeholder of fields or first value on dropdown', 'wpdirectorykit'); ?> |
| 103 |
</p> |
| 104 |
</td> |
| 105 |
</tr> |
| 106 |
<tr> |
| 107 |
<th scope="row"><label |
| 108 |
for="columns_number"><?php echo __('Columns number/Width', 'wpdirectorykit'); ?></label> |
| 109 |
</th> |
| 110 |
<td> |
| 111 |
<input name="columns_number" type="number" id="columns_number" |
| 112 |
value="<?php echo esc_attr(wmvc_show_data('columns_number', $db_data, '')); ?>" |
| 113 |
class="regular-text"> |
| 114 |
<p class="description" id="columns_number-description"> |
| 115 |
<?php echo __('Full width is 12 columns, so define wanted columns allocation number for this field', 'wpdirectorykit'); ?> |
| 116 |
</p> |
| 117 |
</td> |
| 118 |
</tr> |
| 119 |
<tr> |
| 120 |
<th scope="row"><?php echo __('Field is required', 'wpdirectorykit'); ?></th> |
| 121 |
<td> |
| 122 |
<fieldset> |
| 123 |
<legend class="screen-reader-text"> |
| 124 |
<span><?php echo __('Field is required', 'wpdirectorykit'); ?></span> |
| 125 |
</legend> |
| 126 |
<label for="is_required"> |
| 127 |
<input name="is_required" type="checkbox" id="is_required" |
| 128 |
value="1" |
| 129 |
<?php echo !empty(wmvc_show_data('is_required', $db_data, '')) ? 'checked' : ''; ?>> |
| 130 |
<?php echo __('Required', 'wpdirectorykit'); ?> |
| 131 |
<?php echo __('( Not for section type)', 'wpdirectorykit'); ?> |
| 132 |
</label> |
| 133 |
</fieldset> |
| 134 |
</td> |
| 135 |
</tr> |
| 136 |
<tr> |
| 137 |
<th scope="row"><?php echo __('Field is visible on Listing Preview', 'wpdirectorykit'); ?></th> |
| 138 |
<td> |
| 139 |
<fieldset> |
| 140 |
<legend class="screen-reader-text"> |
| 141 |
<span><?php echo __('Field is visible on Listing Preview', 'wpdirectorykit'); ?></span> |
| 142 |
</legend> |
| 143 |
<label for="is_visible_frontend"> |
| 144 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 145 |
value="1" |
| 146 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, '')) ? 'checked' : ''; ?>> |
| 147 |
<?php echo __('( Not for section type)', 'wpdirectorykit'); ?> |
| 148 |
</label> |
| 149 |
</fieldset> |
| 150 |
</td> |
| 151 |
</tr> |
| 152 |
<tr> |
| 153 |
<th scope="row"><?php echo __('Field is visible on frontend submission', 'wpdirectorykit'); ?></th> |
| 154 |
<td> |
| 155 |
<fieldset> |
| 156 |
<legend class="screen-reader-text"> |
| 157 |
<span><?php echo __('Field is visible on frontend submission', 'wpdirectorykit'); ?></span> |
| 158 |
</legend> |
| 159 |
<label for="is_visible_dashboard"> |
| 160 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 161 |
value="1" |
| 162 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, '')) ? 'checked' : ''; ?>> |
| 163 |
<?php echo __('( Not for section type)', 'wpdirectorykit'); ?> |
| 164 |
</label> |
| 165 |
</fieldset> |
| 166 |
</td> |
| 167 |
</tr> |
| 168 |
<tr> |
| 169 |
<th scope="row"><?php echo __('Price format', 'wpdirectorykit'); ?></th> |
| 170 |
<td> |
| 171 |
<fieldset> |
| 172 |
<legend class="screen-reader-text"> |
| 173 |
<span><?php echo __('Price format', 'wpdirectorykit'); ?></span> |
| 174 |
</legend> |
| 175 |
<label for="is_price_format"> |
| 176 |
<input name="is_price_format" type="checkbox" id="is_price_format" |
| 177 |
value="1" |
| 178 |
<?php echo !empty(wmvc_show_data('is_price_format', $db_data, '')) ? 'checked' : ''; ?>> |
| 179 |
<?php echo __('Use wp price format based on language ( Only for number field type)', 'wpdirectorykit'); ?> |
| 180 |
</label> |
| 181 |
</fieldset> |
| 182 |
</td> |
| 183 |
</tr> |
| 184 |
<tr> |
| 185 |
<th scope="row"> |
| 186 |
<label for="validation"><?php echo __('Validation', 'wpdirectorykit'); ?></label> |
| 187 |
</th> |
| 188 |
<td> |
| 189 |
<?php |
| 190 |
echo wmvc_select_option('validation', array_merge(array('' => __('Not Selected', 'wpdirectorykit')), $this->field_m->fields_validations), wmvc_show_data('validation', $db_data, ''), 'id="validation"'); |
| 191 |
?> |
| 192 |
</td> |
| 193 |
</tr> |
| 194 |
<tr> |
| 195 |
<th scope="row"> |
| 196 |
<label for="autosuggestion"><?php echo __('Autosuggestion', 'wpdirectorykit'); ?></label> |
| 197 |
</th> |
| 198 |
<td> |
| 199 |
<select name="autosuggestion" id="autosuggestion" |
| 200 |
<?php if (!file_exists(ABSPATH . 'wp-content/plugins/wdk-autosuggestion/wdk-autosuggestion.php')): ?> |
| 201 |
class="wdk-pro-select" |
| 202 |
data-button-success="<?php echo esc_attr__('Purchase Now', 'wpdirectorykit'); ?>" |
| 203 |
data-title="<?php echo esc_attr__('Your version doesn\'t support this functionality, please upgrade', 'wpdirectorykit'); ?>" |
| 204 |
data-content="<?php echo esc_attr__('We constantly maintain compatibility and improving this plugin for living, please support us and purchase, we provide very reasonable prices and will always do our best to help you!', 'wpdirectorykit'); ?>" |
| 205 |
data-action="https://www.wpdirectorykit.com/plugins.html/" |
| 206 |
<?php elseif (file_exists(ABSPATH . 'wp-content/plugins/wdk-autosuggestion/wdk-autosuggestion.php') && !function_exists('run_wdk_autosuggestion')): ?> |
| 207 |
class="wdk-pro-select" |
| 208 |
data-button-success="<?php echo esc_attr__('Activate addon WDK Autosuggestion', 'wpdirectorykit'); ?>" |
| 209 |
data-title="<?php echo esc_attr__('Your version doesn\'t support this functionality, please upgrade', 'wpdirectorykit'); ?>" |
| 210 |
data-content="<?php echo esc_attr__('We constantly maintain compatibility and improving this plugin for living, please support us and purchase, we provide very reasonable prices and will always do our best to help you!', 'wpdirectorykit'); ?>" |
| 211 |
data-action="<?php echo esc_url(get_admin_url() . "plugins.php?plugin_status=all#activate-wdk-autosuggestion"); ?>" |
| 212 |
<?php endif; ?>> |
| 213 |
<option value=""><?php echo __('Not Selected', 'wpdirectorykit'); ?></option> |
| 214 |
<?php foreach ($this->field_m->fields_autosuggestions as $key => $value): ?> |
| 215 |
<option class="<?php if (in_array($key, ['google_api_cities', 'google_api_countries', 'rapid_api_cities'])): ?>pro-value<?php endif; ?>" value="<?php echo esc_attr($key); ?>" <?php echo !empty(wmvc_show_data('autosuggestion', $db_data, '') == $key) ? 'selected="selected"' : ''; ?>><?php echo esc_html($value); ?></option> |
| 216 |
<?php endforeach; ?> |
| 217 |
</select> |
| 218 |
</td> |
| 219 |
</tr> |
| 220 |
<tr> |
| 221 |
<th scope="row"><label |
| 222 |
for="min_length"><?php echo __('Min Length', 'wpdirectorykit'); ?></label> |
| 223 |
</th> |
| 224 |
<td> |
| 225 |
<input name="min_length" type="number" id="min_length" |
| 226 |
value="<?php echo esc_attr(wmvc_show_data('min_length', $db_data, '')); ?>" |
| 227 |
class="regular-text"> |
| 228 |
<p class="description" id="columns_number-description"> |
| 229 |
<?php echo __('Min Characters or min number (if number field type)', 'wpdirectorykit'); ?> |
| 230 |
</p> |
| 231 |
</td> |
| 232 |
</tr> |
| 233 |
<tr> |
| 234 |
<th scope="row"><label |
| 235 |
for="max_length"><?php echo __('Max Length', 'wpdirectorykit'); ?></label> |
| 236 |
</th> |
| 237 |
<td> |
| 238 |
<input name="max_length" type="number" id="max_length" |
| 239 |
value="<?php echo esc_attr(wmvc_show_data('max_length', $db_data, '')); ?>" |
| 240 |
class="regular-text"> |
| 241 |
<p class="description" id="columns_number-description"> |
| 242 |
<?php echo __('Max Characters or max number (if number field type)', 'wpdirectorykit'); ?> |
| 243 |
</p> |
| 244 |
</td> |
| 245 |
</tr> |
| 246 |
<?php if (false): ?> |
| 247 |
<tr> |
| 248 |
<th scope="row"><?php echo __('Visible on', 'wpdirectorykit'); ?></th> |
| 249 |
<td> |
| 250 |
<fieldset> |
| 251 |
<legend class="screen-reader-text"> |
| 252 |
<span><?php echo __('Visible on', 'wpdirectorykit'); ?></span> |
| 253 |
</legend> |
| 254 |
<label for="is_visible_frontend"> |
| 255 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 256 |
value="1" |
| 257 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, '')) ? 'checked' : ''; ?>> |
| 258 |
<?php echo __('Frontend', 'wpdirectorykit'); ?> |
| 259 |
</label> |
| 260 |
<label for="is_visible_dashboard"> |
| 261 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 262 |
value="1" |
| 263 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, '')) ? 'checked' : ''; ?>> |
| 264 |
<?php echo __('Dashboard', 'wpdirectorykit'); ?> |
| 265 |
</label> |
| 266 |
</fieldset> |
| 267 |
</td> |
| 268 |
</tr> |
| 269 |
<?php endif; ?> |
| 270 |
<tr> |
| 271 |
<th scope="row"><label for="icon_id"><?php echo __('Icon', 'wpdirectorykit'); ?></label> |
| 272 |
</th> |
| 273 |
<td> |
| 274 |
<?php |
| 275 |
echo wmvc_upload_media('icon_id', wmvc_show_data('icon_id', $db_data, '')); |
| 276 |
?> |
| 277 |
<p class="description" id="icon_id-description"> |
| 278 |
<?php echo __('Icon used for amenities or special places on website', 'wpdirectorykit'); ?> |
| 279 |
</p> |
| 280 |
</td> |
| 281 |
</tr> |
| 282 |
<tr> |
| 283 |
<th scope="row"><label for="prefix"><?php echo __('Prefix', 'wpdirectorykit'); ?></label> |
| 284 |
</th> |
| 285 |
<td> |
| 286 |
<input name="prefix" type="text" id="prefix" |
| 287 |
value="<?php echo esc_attr(wmvc_show_data('prefix', $db_data, '')); ?>" |
| 288 |
class="regular-text"> |
| 289 |
<p class="description" id="prefix-description"> |
| 290 |
<?php echo __('Visible before field value usable in currency like $999', 'wpdirectorykit'); ?> |
| 291 |
</p> |
| 292 |
</td> |
| 293 |
</tr> |
| 294 |
<tr> |
| 295 |
<th scope="row"><label for="suffix"><?php echo __('Suffix', 'wpdirectorykit'); ?></label> |
| 296 |
</th> |
| 297 |
<td> |
| 298 |
<input name="suffix" type="text" id="suffix" |
| 299 |
value="<?php echo esc_attr(wmvc_show_data('suffix', $db_data, '')); ?>" |
| 300 |
class="regular-text"> |
| 301 |
<p class="description" id="suffix-description"> |
| 302 |
<?php echo __('Visible after field value usable in metrics like 200ft', 'wpdirectorykit'); ?> |
| 303 |
</p> |
| 304 |
</td> |
| 305 |
</tr> |
| 306 |
<tr> |
| 307 |
<th scope="row"><label |
| 308 |
for="values_list"><?php echo __('Values', 'wpdirectorykit'); ?></label></th> |
| 309 |
<td> |
| 310 |
<input name="values_list" type="text" id="values_list" |
| 311 |
value="<?php echo esc_attr(wmvc_show_data('values_list', $db_data, '')); ?>" |
| 312 |
class="regular-text"> |
| 313 |
<p class="description" id="values_list-description"> |
| 314 |
<?php echo __('Values selectable in dropdown, separate with, like value1,value2,value3', 'wpdirectorykit'); ?> |
| 315 |
</p> |
| 316 |
</td> |
| 317 |
</tr> |
| 318 |
<tr> |
| 319 |
<th scope="row"><label |
| 320 |
for="empty_value"><?php echo __('Value when empty', 'wpdirectorykit'); ?></label></th> |
| 321 |
<td> |
| 322 |
<input name="empty_value" type="text" id="empty_value" |
| 323 |
value="<?php echo esc_attr(wmvc_show_data('empty_value', $db_data, '')); ?>" |
| 324 |
class="regular-text"> |
| 325 |
<p class="description" id="empty_value-description"> |
| 326 |
<?php echo __('This value will be visible if this field is not populated', 'wpdirectorykit'); ?> |
| 327 |
</p> |
| 328 |
</td> |
| 329 |
</tr> |
| 330 |
</tbody> |
| 331 |
</table> |
| 332 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_html__('Save Changes', 'wpdirectorykit'); ?>"> |
| 333 |
</form> |
| 334 |
</div> |
| 335 |
</div> |
| 336 |
</div> |
| 337 |
</div> |
| 338 |
<?php |
| 339 |
wp_enqueue_style('jquery-confirm'); |
| 340 |
wp_enqueue_script('jquery-confirm'); |
| 341 |
?> |
| 342 |
<?php $this->view('general/footer', $data); ?> |