| 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 esc_html__('Fields Management', 'wpdirectorykit'); ?></h1> |
| 18 |
<br /> |
| 19 |
<div class="wdk-body"> |
| 20 |
<div class="postbox" style="display: block;"> |
| 21 |
<div class="postbox-header"> |
| 22 |
<h3><?php echo esc_html__('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( |
| 32 |
'class="alert alert-danger"', |
| 33 |
wp_kses( |
| 34 |
sprintf( |
| 35 |
/* translators: 1: URL. */ |
| 36 |
__('Successfully saved, <a href="%1$s">Back to Fields Management </a>', 'wpdirectorykit'), |
| 37 |
esc_url(admin_url('admin.php?page=wdk_fields')) |
| 38 |
), |
| 39 |
array( |
| 40 |
'a' => array( |
| 41 |
'href' => true, |
| 42 |
), |
| 43 |
) |
| 44 |
) |
| 45 |
); |
| 46 |
?> |
| 47 |
|
| 48 |
<table class="form-table" role="presentation"> |
| 49 |
<tbody> |
| 50 |
<?php if (wmvc_show_data('field_type', $db_data) != "SECTION"): ?> |
| 51 |
<tr> |
| 52 |
<th scope="row"> |
| 53 |
<label for="field_type"><?php echo esc_html__('Section', 'wpdirectorykit'); ?></label> |
| 54 |
</th> |
| 55 |
<td> |
| 56 |
<?php |
| 57 |
echo wp_kses( |
| 58 |
wmvc_select_option('section', $section_list, $selected_section), |
| 59 |
array( |
| 60 |
'select' => array( |
| 61 |
'id' => true, |
| 62 |
'name' => true, |
| 63 |
'class' => true, |
| 64 |
'style' => true, |
| 65 |
'multiple' => true, |
| 66 |
'size' => true, |
| 67 |
), |
| 68 |
'option' => array( |
| 69 |
'value' => true, |
| 70 |
'selected' => true, |
| 71 |
'disabled' => true, |
| 72 |
), |
| 73 |
) |
| 74 |
); |
| 75 |
|
| 76 |
?> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<?php endif; ?> |
| 80 |
<tr> |
| 81 |
<th scope="row"> |
| 82 |
<label for="field_type"><?php echo esc_html__('Field Type', 'wpdirectorykit'); ?></label> |
| 83 |
</th> |
| 84 |
<td> |
| 85 |
<?php |
| 86 |
echo wp_kses( |
| 87 |
wmvc_select_option('field_type', $field_types, wmvc_show_data('field_type', $db_data, '')), |
| 88 |
array( |
| 89 |
'select' => array( |
| 90 |
'id' => true, |
| 91 |
'name' => true, |
| 92 |
'class' => true, |
| 93 |
'style' => true, |
| 94 |
'multiple' => true, |
| 95 |
'size' => true, |
| 96 |
), |
| 97 |
'option' => array( |
| 98 |
'value' => true, |
| 99 |
'selected' => true, |
| 100 |
'disabled' => true, |
| 101 |
), |
| 102 |
) |
| 103 |
); |
| 104 |
|
| 105 |
?> |
| 106 |
</td> |
| 107 |
</tr> |
| 108 |
<tr> |
| 109 |
<th scope="row"> |
| 110 |
<label for="date_format"><?php echo esc_html__('Date format', 'wpdirectorykit'); ?></label> |
| 111 |
</th> |
| 112 |
<td> |
| 113 |
<input name="date_format" type="text" id="date_format" |
| 114 |
value="<?php echo esc_attr(wmvc_show_data('date_format', $db_data, '')); ?>" |
| 115 |
class="regular-text"> |
| 116 |
<p class="description" id="hint-description"> |
| 117 |
<?php echo esc_html__('Date Format for Front - End View', 'wpdirectorykit'); ?> |
| 118 |
</p> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
<tr> |
| 122 |
<th scope="row"> |
| 123 |
<label for="field_label"><?php echo esc_html__('Field Label', 'wpdirectorykit'); ?></label> |
| 124 |
</th> |
| 125 |
<td> |
| 126 |
<input name="field_label" type="text" id="field_label" |
| 127 |
value="<?php echo esc_attr(wmvc_show_data('field_label', $db_data, '')); ?>" |
| 128 |
class="regular-text"> |
| 129 |
|
| 130 |
</td> |
| 131 |
</tr> |
| 132 |
<tr> |
| 133 |
<th scope="row"><label for="hint"><?php echo esc_html__('Hint', 'wpdirectorykit'); ?></label> |
| 134 |
</th> |
| 135 |
<td> |
| 136 |
<input name="hint" type="text" id="hint" |
| 137 |
value="<?php echo esc_attr(wmvc_show_data('hint', $db_data, '')); ?>" |
| 138 |
class="regular-text"> |
| 139 |
<p class="description" id="hint-description"> |
| 140 |
<?php echo esc_html__('Hint is showing below fields like this one', 'wpdirectorykit'); ?> |
| 141 |
</p> |
| 142 |
</td> |
| 143 |
</tr> |
| 144 |
<tr> |
| 145 |
<th scope="row"><label for="placeholder"><?php echo esc_html__('Placeholder', 'wpdirectorykit'); ?></label> |
| 146 |
</th> |
| 147 |
<td> |
| 148 |
<input name="placeholder" type="text" id="placeholder" |
| 149 |
value="<?php echo esc_attr(wmvc_show_data('placeholder', $db_data, '')); ?>" |
| 150 |
class="regular-text"> |
| 151 |
<p class="description" id="placeholder-description"> |
| 152 |
<?php echo esc_html__('Placeholder is showing on placeholder of fields or first value on dropdown', 'wpdirectorykit'); ?> |
| 153 |
</p> |
| 154 |
</td> |
| 155 |
</tr> |
| 156 |
<tr> |
| 157 |
<th scope="row"><label |
| 158 |
for="columns_number"><?php echo esc_html__('Columns number/Width', 'wpdirectorykit'); ?></label> |
| 159 |
</th> |
| 160 |
<td> |
| 161 |
<input name="columns_number" type="number" id="columns_number" |
| 162 |
value="<?php echo esc_attr(wmvc_show_data('columns_number', $db_data, '')); ?>" |
| 163 |
class="regular-text"> |
| 164 |
<p class="description" id="columns_number-description"> |
| 165 |
<?php echo esc_html__('Full width is 12 columns, so define wanted columns allocation number for this field', 'wpdirectorykit'); ?> |
| 166 |
</p> |
| 167 |
</td> |
| 168 |
</tr> |
| 169 |
<tr> |
| 170 |
<th scope="row"><?php echo esc_html__('Field is required', 'wpdirectorykit'); ?></th> |
| 171 |
<td> |
| 172 |
<fieldset> |
| 173 |
<legend class="screen-reader-text"> |
| 174 |
<span><?php echo esc_html__('Field is required', 'wpdirectorykit'); ?></span> |
| 175 |
</legend> |
| 176 |
<label for="is_required"> |
| 177 |
<input name="is_required" type="checkbox" id="is_required" |
| 178 |
value="1" |
| 179 |
<?php echo !empty(wmvc_show_data('is_required', $db_data, '')) ? 'checked' : ''; ?>> |
| 180 |
<?php echo esc_html__('Required', 'wpdirectorykit'); ?> |
| 181 |
<?php echo esc_html__('( Not for section type)', 'wpdirectorykit'); ?> |
| 182 |
</label> |
| 183 |
</fieldset> |
| 184 |
</td> |
| 185 |
</tr> |
| 186 |
<tr> |
| 187 |
<th scope="row"><?php echo esc_html__('Field is visible on Listing Preview', 'wpdirectorykit'); ?></th> |
| 188 |
<td> |
| 189 |
<fieldset> |
| 190 |
<legend class="screen-reader-text"> |
| 191 |
<span><?php echo esc_html__('Field is visible on Listing Preview', 'wpdirectorykit'); ?></span> |
| 192 |
</legend> |
| 193 |
<label for="is_visible_frontend"> |
| 194 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 195 |
value="1" |
| 196 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, '')) ? 'checked' : ''; ?>> |
| 197 |
<?php echo esc_html__('( Not for section type)', 'wpdirectorykit'); ?> |
| 198 |
</label> |
| 199 |
</fieldset> |
| 200 |
</td> |
| 201 |
</tr> |
| 202 |
<tr> |
| 203 |
<th scope="row"><?php echo esc_html__('Field is visible on frontend submission', 'wpdirectorykit'); ?></th> |
| 204 |
<td> |
| 205 |
<fieldset> |
| 206 |
<legend class="screen-reader-text"> |
| 207 |
<span><?php echo esc_html__('Field is visible on frontend submission', 'wpdirectorykit'); ?></span> |
| 208 |
</legend> |
| 209 |
<label for="is_visible_dashboard"> |
| 210 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 211 |
value="1" |
| 212 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, '')) ? 'checked' : ''; ?>> |
| 213 |
<?php echo esc_html__('( Not for section type)', 'wpdirectorykit'); ?> |
| 214 |
</label> |
| 215 |
</fieldset> |
| 216 |
</td> |
| 217 |
</tr> |
| 218 |
<tr> |
| 219 |
<th scope="row"><?php echo esc_html__('Price format', 'wpdirectorykit'); ?></th> |
| 220 |
<td> |
| 221 |
<fieldset> |
| 222 |
<legend class="screen-reader-text"> |
| 223 |
<span><?php echo esc_html__('Price format', 'wpdirectorykit'); ?></span> |
| 224 |
</legend> |
| 225 |
<label for="is_price_format"> |
| 226 |
<input name="is_price_format" type="checkbox" id="is_price_format" |
| 227 |
value="1" |
| 228 |
<?php echo !empty(wmvc_show_data('is_price_format', $db_data, '')) ? 'checked' : ''; ?>> |
| 229 |
<?php echo esc_html__('Use wp price format based on language ( Only for number field type)', 'wpdirectorykit'); ?> |
| 230 |
</label> |
| 231 |
</fieldset> |
| 232 |
</td> |
| 233 |
</tr> |
| 234 |
<tr> |
| 235 |
<th scope="row"> |
| 236 |
<label for="validation"><?php echo esc_html__('Validation', 'wpdirectorykit'); ?></label> |
| 237 |
</th> |
| 238 |
<td> |
| 239 |
<?php |
| 240 |
echo wp_kses( |
| 241 |
wmvc_select_option( |
| 242 |
'validation', |
| 243 |
array_merge(array('' => __('Not Selected', 'wpdirectorykit')), $this->field_m->fields_validations), |
| 244 |
wmvc_show_data('validation', $db_data, ''), |
| 245 |
'id="validation"' |
| 246 |
), |
| 247 |
array( |
| 248 |
'select' => array( |
| 249 |
'id' => true, |
| 250 |
'name' => true, |
| 251 |
'class' => true, |
| 252 |
'style' => true, |
| 253 |
'multiple' => true, |
| 254 |
'size' => true, |
| 255 |
), |
| 256 |
'option' => array( |
| 257 |
'value' => true, |
| 258 |
'selected' => true, |
| 259 |
'disabled' => true, |
| 260 |
), |
| 261 |
) |
| 262 |
); |
| 263 |
|
| 264 |
?> |
| 265 |
</td> |
| 266 |
</tr> |
| 267 |
<tr> |
| 268 |
<th scope="row"> |
| 269 |
<label for="autosuggestion"><?php echo esc_html__('Autosuggestion', 'wpdirectorykit'); ?></label> |
| 270 |
</th> |
| 271 |
<td> |
| 272 |
<select name="autosuggestion" id="autosuggestion" |
| 273 |
<?php if (!file_exists(ABSPATH . 'wp-content/plugins/wdk-autosuggestion/wdk-autosuggestion.php')): ?> |
| 274 |
class="wdk-pro-select" |
| 275 |
data-button-success="<?php echo esc_attr__('Purchase Now', 'wpdirectorykit'); ?>" |
| 276 |
data-title="<?php echo esc_attr__('Your version doesn\'t support this functionality, please upgrade', 'wpdirectorykit'); ?>" |
| 277 |
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'); ?>" |
| 278 |
data-action="https://www.wpdirectorykit.com/plugins.html/" |
| 279 |
<?php elseif (file_exists(ABSPATH . 'wp-content/plugins/wdk-autosuggestion/wdk-autosuggestion.php') && !function_exists('run_wdk_autosuggestion')): ?> |
| 280 |
class="wdk-pro-select" |
| 281 |
data-button-success="<?php echo esc_attr__('Activate addon WDK Autosuggestion', 'wpdirectorykit'); ?>" |
| 282 |
data-title="<?php echo esc_attr__('Your version doesn\'t support this functionality, please upgrade', 'wpdirectorykit'); ?>" |
| 283 |
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'); ?>" |
| 284 |
data-action="<?php echo esc_url(get_admin_url() . "plugins.php?plugin_status=all#activate-wdk-autosuggestion"); ?>" |
| 285 |
<?php endif; ?>> |
| 286 |
<option value=""><?php echo esc_html__('Not Selected', 'wpdirectorykit'); ?></option> |
| 287 |
<?php foreach ($this->field_m->fields_autosuggestions as $key => $value): ?> |
| 288 |
<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> |
| 289 |
<?php endforeach; ?> |
| 290 |
</select> |
| 291 |
</td> |
| 292 |
</tr> |
| 293 |
<tr> |
| 294 |
<th scope="row"><label |
| 295 |
for="min_length"><?php echo esc_html__('Min Length', 'wpdirectorykit'); ?></label> |
| 296 |
</th> |
| 297 |
<td> |
| 298 |
<input name="min_length" type="number" id="min_length" |
| 299 |
value="<?php echo esc_attr(wmvc_show_data('min_length', $db_data, '')); ?>" |
| 300 |
class="regular-text"> |
| 301 |
<p class="description" id="columns_number-description"> |
| 302 |
<?php echo esc_html__('Min Characters or min number (if number field type)', 'wpdirectorykit'); ?> |
| 303 |
</p> |
| 304 |
</td> |
| 305 |
</tr> |
| 306 |
<tr> |
| 307 |
<th scope="row"><label |
| 308 |
for="max_length"><?php echo esc_html__('Max Length', 'wpdirectorykit'); ?></label> |
| 309 |
</th> |
| 310 |
<td> |
| 311 |
<input name="max_length" type="number" id="max_length" |
| 312 |
value="<?php echo esc_attr(wmvc_show_data('max_length', $db_data, '')); ?>" |
| 313 |
class="regular-text"> |
| 314 |
<p class="description" id="columns_number-description"> |
| 315 |
<?php echo esc_html__('Max Characters or max number (if number field type)', 'wpdirectorykit'); ?> |
| 316 |
</p> |
| 317 |
</td> |
| 318 |
</tr> |
| 319 |
<?php if (false): ?> |
| 320 |
<tr> |
| 321 |
<th scope="row"><?php echo esc_html__('Visible on', 'wpdirectorykit'); ?></th> |
| 322 |
<td> |
| 323 |
<fieldset> |
| 324 |
<legend class="screen-reader-text"> |
| 325 |
<span><?php echo esc_html__('Visible on', 'wpdirectorykit'); ?></span> |
| 326 |
</legend> |
| 327 |
<label for="is_visible_frontend"> |
| 328 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 329 |
value="1" |
| 330 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, '')) ? 'checked' : ''; ?>> |
| 331 |
<?php echo esc_html__('Frontend', 'wpdirectorykit'); ?> |
| 332 |
</label> |
| 333 |
<label for="is_visible_dashboard"> |
| 334 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 335 |
value="1" |
| 336 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, '')) ? 'checked' : ''; ?>> |
| 337 |
<?php echo esc_html__('Dashboard', 'wpdirectorykit'); ?> |
| 338 |
</label> |
| 339 |
</fieldset> |
| 340 |
</td> |
| 341 |
</tr> |
| 342 |
<?php endif; ?> |
| 343 |
<tr> |
| 344 |
<th scope="row"><label for="icon_id"><?php echo esc_html__('Icon', 'wpdirectorykit'); ?></label> |
| 345 |
</th> |
| 346 |
<td> |
| 347 |
<?php |
| 348 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText |
| 349 |
echo wmvc_upload_media('icon_id', wmvc_show_data('icon_id', $db_data, '')); |
| 350 |
?> |
| 351 |
<p class="description" id="icon_id-description"> |
| 352 |
<?php echo esc_html__('Icon used for amenities or special places on website', 'wpdirectorykit'); ?> |
| 353 |
</p> |
| 354 |
</td> |
| 355 |
</tr> |
| 356 |
<tr> |
| 357 |
<th scope="row"><label for="prefix"><?php echo esc_html__('Prefix', 'wpdirectorykit'); ?></label> |
| 358 |
</th> |
| 359 |
<td> |
| 360 |
<input name="prefix" type="text" id="prefix" |
| 361 |
value="<?php echo esc_attr(wmvc_show_data('prefix', $db_data, '')); ?>" |
| 362 |
class="regular-text"> |
| 363 |
<p class="description" id="prefix-description"> |
| 364 |
<?php echo esc_html__('Visible before field value usable in currency like $999', 'wpdirectorykit'); ?> |
| 365 |
</p> |
| 366 |
</td> |
| 367 |
</tr> |
| 368 |
<tr> |
| 369 |
<th scope="row"><label for="suffix"><?php echo esc_html__('Suffix', 'wpdirectorykit'); ?></label> |
| 370 |
</th> |
| 371 |
<td> |
| 372 |
<input name="suffix" type="text" id="suffix" |
| 373 |
value="<?php echo esc_attr(wmvc_show_data('suffix', $db_data, '')); ?>" |
| 374 |
class="regular-text"> |
| 375 |
<p class="description" id="suffix-description"> |
| 376 |
<?php echo esc_html__('Visible after field value usable in metrics like 200ft', 'wpdirectorykit'); ?> |
| 377 |
</p> |
| 378 |
</td> |
| 379 |
</tr> |
| 380 |
<tr> |
| 381 |
<th scope="row"><label |
| 382 |
for="values_list"><?php echo esc_html__('Values', 'wpdirectorykit'); ?></label></th> |
| 383 |
<td> |
| 384 |
<input name="values_list" type="text" id="values_list" |
| 385 |
value="<?php echo esc_attr(wmvc_show_data('values_list', $db_data, '')); ?>" |
| 386 |
class="regular-text"> |
| 387 |
<p class="description" id="values_list-description"> |
| 388 |
<?php echo esc_html__('Values selectable in dropdown, separate with, like value1,value2,value3', 'wpdirectorykit'); ?> |
| 389 |
</p> |
| 390 |
</td> |
| 391 |
</tr> |
| 392 |
<tr> |
| 393 |
<th scope="row"><label |
| 394 |
for="empty_value"><?php echo esc_html__('Value when empty', 'wpdirectorykit'); ?></label></th> |
| 395 |
<td> |
| 396 |
<input name="empty_value" type="text" id="empty_value" |
| 397 |
value="<?php echo esc_attr(wmvc_show_data('empty_value', $db_data, '')); ?>" |
| 398 |
class="regular-text"> |
| 399 |
<p class="description" id="empty_value-description"> |
| 400 |
<?php echo esc_html__('This value will be visible if this field is not populated', 'wpdirectorykit'); ?> |
| 401 |
</p> |
| 402 |
</td> |
| 403 |
</tr> |
| 404 |
</tbody> |
| 405 |
</table> |
| 406 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_attr__('Save Changes', 'wpdirectorykit'); ?>"> |
| 407 |
</form> |
| 408 |
</div> |
| 409 |
</div> |
| 410 |
</div> |
| 411 |
</div> |
| 412 |
<?php |
| 413 |
wp_enqueue_style('jquery-confirm'); |
| 414 |
wp_enqueue_script('jquery-confirm'); |
| 415 |
?> |
| 416 |
<?php $this->view('general/footer', $data); ?> |