| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Edit Field. |
| 4 |
* |
| 5 |
* This is the template that form edit |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 14 |
|
| 15 |
<div class="wrap wdk-wrap"> |
| 16 |
<h1 class="wp-heading-inline"><?php echo __('Fields Management','wpdirectorykit'); ?></h1> |
| 17 |
<br /><br /> |
| 18 |
<div class="wdk-body"> |
| 19 |
<div class="postbox" style="display: block;"> |
| 20 |
<div class="postbox-header"> |
| 21 |
<h3><?php echo __('Add/Edit Field','wpdirectorykit'); ?></h3> |
| 22 |
</div> |
| 23 |
<div class="inside"> |
| 24 |
|
| 25 |
<form method="post" action="<?php echo wmvc_current_edit_url(); ?>" novalidate="novalidate"> |
| 26 |
|
| 27 |
<?php wp_nonce_field( 'wdk-fields-edit_'.wmvc_show_data('idfield', $db_data, 0), '_wpnonce'); ?> |
| 28 |
|
| 29 |
<?php |
| 30 |
$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'))); |
| 31 |
?> |
| 32 |
|
| 33 |
<table class="form-table" role="presentation"> |
| 34 |
<tbody> |
| 35 |
<?php if(wmvc_show_data('field_type', $db_data) != "SECTION"):?> |
| 36 |
<tr> |
| 37 |
<th scope="row"> |
| 38 |
<label for="field_type"><?php echo __('Section','wpdirectorykit'); ?></label> |
| 39 |
</th> |
| 40 |
<td> |
| 41 |
<?php |
| 42 |
echo wmvc_select_option('section', $section_list, (!empty(wmvc_show_data('idfield', $db_data, '')) && isset($fields_categories[wmvc_show_data('idfield', $db_data, '')])) ? $fields_categories[wmvc_show_data('idfield', $db_data)] : ''); |
| 43 |
?> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
<?php endif;?> |
| 47 |
<tr> |
| 48 |
<th scope="row"> |
| 49 |
<label for="field_type"><?php echo __('Field Type','wpdirectorykit'); ?></label> |
| 50 |
</th> |
| 51 |
<td> |
| 52 |
<?php |
| 53 |
echo wmvc_select_option('field_type', $field_types, wmvc_show_data('field_type', $db_data, '')); |
| 54 |
?> |
| 55 |
</td> |
| 56 |
</tr> |
| 57 |
<tr> |
| 58 |
<th scope="row"> |
| 59 |
<label for="field_label"><?php echo __('Field Label','wpdirectorykit'); ?></label> |
| 60 |
</th> |
| 61 |
<td> |
| 62 |
<input name="field_label" type="text" id="field_label" |
| 63 |
value="<?php echo wmvc_show_data('field_label', $db_data, ''); ?>" |
| 64 |
class="regular-text"> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
<tr> |
| 68 |
<th scope="row"><label for="hint"><?php echo __('Hint','wpdirectorykit'); ?></label> |
| 69 |
</th> |
| 70 |
<td> |
| 71 |
<input name="hint" type="text" id="hint" |
| 72 |
value="<?php echo wmvc_show_data('hint', $db_data, ''); ?>" |
| 73 |
class="regular-text"> |
| 74 |
<p class="description" id="hint-description"> |
| 75 |
<?php echo __('Hint is showing below fields like this one','wpdirectorykit'); ?> |
| 76 |
</p> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<th scope="row"><label for="placeholder"><?php echo __('Placeholder','wpdirectorykit'); ?></label> |
| 81 |
</th> |
| 82 |
<td> |
| 83 |
<input name="placeholder" type="text" id="placeholder" |
| 84 |
value="<?php echo wmvc_show_data('placeholder', $db_data, ''); ?>" |
| 85 |
class="regular-text"> |
| 86 |
<p class="description" id="placeholder-description"> |
| 87 |
<?php echo __('Placeholder is showing on placeholder of fields or first value on dropdown','wpdirectorykit'); ?> |
| 88 |
</p> |
| 89 |
</td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<th scope="row"><label |
| 93 |
for="columns_number"><?php echo __('Columns number/Width','wpdirectorykit'); ?></label> |
| 94 |
</th> |
| 95 |
<td> |
| 96 |
<input name="columns_number" type="number" id="columns_number" |
| 97 |
value="<?php echo wmvc_show_data('columns_number', $db_data, ''); ?>" |
| 98 |
class="regular-text"> |
| 99 |
<p class="description" id="columns_number-description"> |
| 100 |
<?php echo __('Full width is 12 columns, so define wanted columns allocation number for this field','wpdirectorykit'); ?> |
| 101 |
</p> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
<tr> |
| 105 |
<th scope="row"><?php echo __('Field is required','wpdirectorykit'); ?></th> |
| 106 |
<td> |
| 107 |
<fieldset> |
| 108 |
<legend class="screen-reader-text"> |
| 109 |
<span><?php echo __('Field is required','wpdirectorykit'); ?></span> |
| 110 |
</legend> |
| 111 |
<label for="is_required"> |
| 112 |
<input name="is_required" type="checkbox" id="is_required" |
| 113 |
value="1" |
| 114 |
<?php echo !empty(wmvc_show_data('is_required', $db_data, ''))?'checked':''; ?>> |
| 115 |
<?php echo __('Required','wpdirectorykit'); ?> |
| 116 |
<?php echo __('( Not for section type)','wpdirectorykit'); ?> |
| 117 |
</label> |
| 118 |
</fieldset> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
<tr> |
| 122 |
<th scope="row"><?php echo __('Field is visible on Listing Preview','wpdirectorykit'); ?></th> |
| 123 |
<td> |
| 124 |
<fieldset> |
| 125 |
<legend class="screen-reader-text"> |
| 126 |
<span><?php echo __('Field is visible on Listing Preview','wpdirectorykit'); ?></span> |
| 127 |
</legend> |
| 128 |
<label for="is_visible_frontend"> |
| 129 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 130 |
value="1" |
| 131 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, ''))?'checked':''; ?>> |
| 132 |
<?php echo __('( Not for section type)','wpdirectorykit'); ?> |
| 133 |
</label> |
| 134 |
</fieldset> |
| 135 |
</td> |
| 136 |
</tr> |
| 137 |
<tr> |
| 138 |
<th scope="row"><?php echo __('Field is visible on frontend submission','wpdirectorykit'); ?></th> |
| 139 |
<td> |
| 140 |
<fieldset> |
| 141 |
<legend class="screen-reader-text"> |
| 142 |
<span><?php echo __('Field is visible on frontend submission','wpdirectorykit'); ?></span> |
| 143 |
</legend> |
| 144 |
<label for="is_visible_dashboard"> |
| 145 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 146 |
value="1" |
| 147 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, ''))?'checked':''; ?>> |
| 148 |
<?php echo __('( Not for section type)','wpdirectorykit'); ?> |
| 149 |
</label> |
| 150 |
</fieldset> |
| 151 |
</td> |
| 152 |
</tr> |
| 153 |
<tr> |
| 154 |
<th scope="row"><?php echo __('Price format','wpdirectorykit'); ?></th> |
| 155 |
<td> |
| 156 |
<fieldset> |
| 157 |
<legend class="screen-reader-text"> |
| 158 |
<span><?php echo __('Price format','wpdirectorykit'); ?></span> |
| 159 |
</legend> |
| 160 |
<label for="is_price_format"> |
| 161 |
<input name="is_price_format" type="checkbox" id="is_price_format" |
| 162 |
value="1" |
| 163 |
<?php echo !empty(wmvc_show_data('is_price_format', $db_data, ''))?'checked':''; ?>> |
| 164 |
<?php echo __('Use wp price format based on language ( Only for number field type)','wpdirectorykit'); ?> |
| 165 |
</label> |
| 166 |
</fieldset> |
| 167 |
</td> |
| 168 |
</tr> |
| 169 |
<tr> |
| 170 |
<th scope="row"> |
| 171 |
<label for="validation"><?php echo __('Validation','wpdirectorykit'); ?></label> |
| 172 |
</th> |
| 173 |
<td> |
| 174 |
<?php |
| 175 |
echo wmvc_select_option('validation', array_merge(array(''=> __('Not Selected','wpdirectorykit')),$this->field_m->fields_validations), wmvc_show_data('validation', $db_data, ''), 'id="validation"'); |
| 176 |
?> |
| 177 |
</td> |
| 178 |
</tr> |
| 179 |
<tr> |
| 180 |
<th scope="row"><label |
| 181 |
for="min_length"><?php echo __('Min Length','wpdirectorykit'); ?></label> |
| 182 |
</th> |
| 183 |
<td> |
| 184 |
<input name="min_length" type="number" id="min_length" |
| 185 |
value="<?php echo wmvc_show_data('min_length', $db_data, ''); ?>" |
| 186 |
class="regular-text"> |
| 187 |
<p class="description" id="columns_number-description"> |
| 188 |
<?php echo __('Min Characters or min number (if number field type)','wpdirectorykit'); ?> |
| 189 |
</p> |
| 190 |
</td> |
| 191 |
</tr> |
| 192 |
<tr> |
| 193 |
<th scope="row"><label |
| 194 |
for="max_length"><?php echo __('Max Length','wpdirectorykit'); ?></label> |
| 195 |
</th> |
| 196 |
<td> |
| 197 |
<input name="max_length" type="number" id="max_length" |
| 198 |
value="<?php echo wmvc_show_data('max_length', $db_data, ''); ?>" |
| 199 |
class="regular-text"> |
| 200 |
<p class="description" id="columns_number-description"> |
| 201 |
<?php echo __('Max Characters or max number (if number field type)','wpdirectorykit'); ?> |
| 202 |
</p> |
| 203 |
</td> |
| 204 |
</tr> |
| 205 |
<?php if(false):?> |
| 206 |
<tr> |
| 207 |
<th scope="row"><?php echo __('Visible on','wpdirectorykit'); ?></th> |
| 208 |
<td> |
| 209 |
<fieldset> |
| 210 |
<legend class="screen-reader-text"> |
| 211 |
<span><?php echo __('Visible on','wpdirectorykit'); ?></span> |
| 212 |
</legend> |
| 213 |
<label for="is_visible_frontend"> |
| 214 |
<input name="is_visible_frontend" type="checkbox" id="is_visible_frontend" |
| 215 |
value="1" |
| 216 |
<?php echo !empty(wmvc_show_data('is_visible_frontend', $db_data, ''))?'checked':''; ?>> |
| 217 |
<?php echo __('Frontend','wpdirectorykit'); ?> |
| 218 |
</label> |
| 219 |
<label for="is_visible_dashboard"> |
| 220 |
<input name="is_visible_dashboard" type="checkbox" id="is_visible_dashboard" |
| 221 |
value="1" |
| 222 |
<?php echo !empty(wmvc_show_data('is_visible_dashboard', $db_data, ''))?'checked':''; ?>> |
| 223 |
<?php echo __('Dashboard','wpdirectorykit'); ?> |
| 224 |
</label> |
| 225 |
</fieldset> |
| 226 |
</td> |
| 227 |
</tr> |
| 228 |
<?php endif;?> |
| 229 |
<tr> |
| 230 |
<th scope="row"><label for="icon_id"><?php echo __('Icon','wpdirectorykit'); ?></label> |
| 231 |
</th> |
| 232 |
<td> |
| 233 |
<?php |
| 234 |
echo wmvc_upload_media('icon_id', wmvc_show_data('icon_id', $db_data, '')); |
| 235 |
?> |
| 236 |
<p class="description" id="icon_id-description"> |
| 237 |
<?php echo __('Icon used for amenities or special places on website','wpdirectorykit'); ?> |
| 238 |
</p> |
| 239 |
</td> |
| 240 |
</tr> |
| 241 |
<tr> |
| 242 |
<th scope="row"><label for="prefix"><?php echo __('Prefix','wpdirectorykit'); ?></label> |
| 243 |
</th> |
| 244 |
<td> |
| 245 |
<input name="prefix" type="text" id="prefix" |
| 246 |
value="<?php echo wmvc_show_data('prefix', $db_data, ''); ?>" |
| 247 |
class="regular-text"> |
| 248 |
<p class="description" id="prefix-description"> |
| 249 |
<?php echo __('Visible before field value usable in currency like $999','wpdirectorykit'); ?> |
| 250 |
</p> |
| 251 |
</td> |
| 252 |
</tr> |
| 253 |
<tr> |
| 254 |
<th scope="row"><label for="suffix"><?php echo __('Suffix','wpdirectorykit'); ?></label> |
| 255 |
</th> |
| 256 |
<td> |
| 257 |
<input name="suffix" type="text" id="suffix" |
| 258 |
value="<?php echo wmvc_show_data('suffix', $db_data, ''); ?>" |
| 259 |
class="regular-text"> |
| 260 |
<p class="description" id="suffix-description"> |
| 261 |
<?php echo __('Visible after field value usable in metrics like 200ft','wpdirectorykit'); ?> |
| 262 |
</p> |
| 263 |
</td> |
| 264 |
</tr> |
| 265 |
<tr> |
| 266 |
<th scope="row"><label |
| 267 |
for="values_list"><?php echo __('Values','wpdirectorykit'); ?></label></th> |
| 268 |
<td> |
| 269 |
<input name="values_list" type="text" id="values_list" |
| 270 |
value="<?php echo wmvc_show_data('values_list', $db_data, ''); ?>" |
| 271 |
class="regular-text"> |
| 272 |
<p class="description" id="values_list-description"> |
| 273 |
<?php echo __('Values selectable in dropdown, separate with, like value1,value2,value3','wpdirectorykit'); ?> |
| 274 |
</p> |
| 275 |
</td> |
| 276 |
</tr> |
| 277 |
</tbody> |
| 278 |
</table> |
| 279 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_html__('Save Changes','wpdirectorykit'); ?>"> |
| 280 |
</form> |
| 281 |
</div> |
| 282 |
</div> |
| 283 |
</div> |
| 284 |
</div> |
| 285 |
|
| 286 |
<?php $this->view('general/footer', $data); ?> |