| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
?> |
| 5 |
<h2 class="cell acym__title acym__title__secondary margin-top-2 acym__fields__edit__section__title" id="acym__fields__edit__section__title--values"> |
| 6 |
<?php echo esc_html(acym_translation('ACYM_FIELD_VALUES')); ?> |
| 7 |
</h2> |
| 8 |
|
| 9 |
<label class="cell large-11 acym__fields__change" id="acym__fields__custom-text"> |
| 10 |
<?php echo esc_html(acym_translation('ACYM_CUSTOM_TEXT')); ?> |
| 11 |
<textarea |
| 12 |
name="field[option][custom_text]" |
| 13 |
cols="30" |
| 14 |
rows="10"><?php echo empty($data['field']->option->custom_text) ? '' : esc_html($data['field']->option->custom_text); ?></textarea> |
| 15 |
</label> |
| 16 |
|
| 17 |
<div class="cell grid-x acym__fields__change margin-bottom-2" id="acym__fields__value"> |
| 18 |
<div class="cell grid-x acym__listing"> |
| 19 |
<div class="grid-x cell acym__listing__fields__header"> |
| 20 |
<div class="medium-1 cell acym__listing__header__title"></div> |
| 21 |
<div class="medium-4 cell acym__listing__header__title text-center"> |
| 22 |
<?php echo esc_html(acym_translation('ACYM_VALUE')); ?> |
| 23 |
</div> |
| 24 |
<div class="medium-4 cell acym__listing__header__title text-center"> |
| 25 |
<?php echo esc_html(acym_translation('ACYM_TITLE')); ?> |
| 26 |
</div> |
| 27 |
<div class="medium-2 cell acym__listing__header__title text-center"> |
| 28 |
<?php echo esc_html(acym_translation('ACYM_DISABLED')); ?> |
| 29 |
</div> |
| 30 |
<div class="small-1 cell acym__listing__header__title"></div> |
| 31 |
</div> |
| 32 |
<div class="acym__fields__values__listing__sortable cell grid-x"> |
| 33 |
<?php if (empty($data['field']->value)) { ?> |
| 34 |
<div class="grid-x cell acym__fields__value__sortable acym__content margin-bottom-1 grid-margin-x margin-y"> |
| 35 |
<div class="medium-1 cell acym_vcenter align-center acym__field__sortable__listing__handle"> |
| 36 |
<div class="grabbable acym__sortable__field__edit__handle grid-x"> |
| 37 |
<i class="acymicon-ellipsis-h cell acym__color__dark-gray"></i> |
| 38 |
<i class="acymicon-ellipsis-h cell acym__color__dark-gray"></i> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
<input type="text" name="field[value][value][]" class="cell medium-4 acym__fields__value__value" value=""> |
| 42 |
<input type="text" name="field[value][title][]" class="cell medium-4 acym__fields__value__title" value=""> |
| 43 |
<div class="cell medium-2"> |
| 44 |
<?php |
| 45 |
acym_select( |
| 46 |
[ |
| 47 |
'n' => acym_translation('ACYM_NO'), |
| 48 |
'y' => acym_translation('ACYM_YES'), |
| 49 |
], |
| 50 |
'field[value][disabled][]', |
| 51 |
'n', |
| 52 |
[ |
| 53 |
'class' => 'acym__fields__edit__select acym__select', |
| 54 |
'acym-data-infinite' => true, |
| 55 |
], |
| 56 |
'value', |
| 57 |
'name', |
| 58 |
null, |
| 59 |
false, |
| 60 |
true |
| 61 |
); ?> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
<?php } else { |
| 65 |
$i = 0; |
| 66 |
foreach ($data['field']->value as $value) { ?> |
| 67 |
<div class="grid-x cell acym__fields__value__sortable acym__content margin-bottom-1 grid-margin-x margin-y"> |
| 68 |
<div class="medium-1 cell acym_vcenter align-center acym__field__sortable__listing__handle"> |
| 69 |
<div class="grabbable acym__sortable__field__edit__handle grid-x"> |
| 70 |
<i class="acymicon-ellipsis-h cell acym__color__dark-gray"></i> |
| 71 |
<i class="acymicon-ellipsis-h cell acym__color__dark-gray"></i> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
<input type="text" name="field[value][value][]" class="cell medium-4 acym__fields__value__value" value="<?php echo esc_attr($value->value); ?>"> |
| 75 |
<input type="text" name="field[value][title][]" class="cell medium-4 acym__fields__value__title" value="<?php echo esc_attr($value->title); ?>"> |
| 76 |
<div class="cell medium-2"> |
| 77 |
<?php |
| 78 |
acym_select( |
| 79 |
[ |
| 80 |
'n' => acym_translation('ACYM_NO'), |
| 81 |
'y' => acym_translation('ACYM_YES'), |
| 82 |
], |
| 83 |
'field[value][disabled][]', |
| 84 |
$value->disabled, |
| 85 |
[ |
| 86 |
'class' => 'acym__fields__edit__select acym__select', |
| 87 |
'acym-data-infinite' => true, |
| 88 |
], |
| 89 |
'value', |
| 90 |
'name', |
| 91 |
null, |
| 92 |
false, |
| 93 |
true |
| 94 |
); |
| 95 |
?> |
| 96 |
</div> |
| 97 |
<i class="cell acymicon-close small-1 acym__color__red cursor-pointer acym__field__delete__value"></i> |
| 98 |
</div> |
| 99 |
<?php $i++; |
| 100 |
} ?> |
| 101 |
<?php } ?> |
| 102 |
</div> |
| 103 |
<button type="button" class="button button-secondary margin-top-1" id="acym__fields__value__add-value"><?php echo esc_html( |
| 104 |
acym_translation( |
| 105 |
'ACYM_ADD_VALUE' |
| 106 |
) |
| 107 |
); ?></button> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
|
| 111 |
<div class="cell grid-x acym__fields__change" id="acym__fields__from-db"> |
| 112 |
<p class="cell"><?php echo esc_html(acym_translation('ACYM_VALUES_FROM_DB')); ?></p> |
| 113 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_DATABASE')); ?> |
| 114 |
<?php |
| 115 |
acym_select( |
| 116 |
$data['database'], |
| 117 |
'fieldDB[database]', |
| 118 |
empty($data['field']->fieldDB->database) ? '' : $data['field']->fieldDB->database, |
| 119 |
[ |
| 120 |
'class' => 'acym__fields__edit__select acym__select', |
| 121 |
'acym-data-infinite' => true, |
| 122 |
], |
| 123 |
'value', |
| 124 |
'name', |
| 125 |
null, |
| 126 |
false, |
| 127 |
true |
| 128 |
); |
| 129 |
?> |
| 130 |
</label> |
| 131 |
<div class="medium-1"></div> |
| 132 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_TABLES')); ?> |
| 133 |
<?php |
| 134 |
acym_select( |
| 135 |
empty($data['field']->fieldDB->tables) ? [] : $data['field']->fieldDB->tables, |
| 136 |
'fieldDB[table]', |
| 137 |
empty($data['field']->fieldDB->table) ? '' : $data['field']->fieldDB->table, |
| 138 |
[ |
| 139 |
'class' => 'acym__fields__edit__select acym__select', |
| 140 |
'acym-data-infinite' => true, |
| 141 |
], |
| 142 |
'value', |
| 143 |
'name', |
| 144 |
null, |
| 145 |
false, |
| 146 |
true |
| 147 |
); |
| 148 |
?> |
| 149 |
</label> |
| 150 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_VALUE')); ?> |
| 151 |
<?php |
| 152 |
acym_select( |
| 153 |
empty($data['field']->fieldDB->columns) ? [] : $data['field']->fieldDB->columns, |
| 154 |
'fieldDB[value]', |
| 155 |
empty($data['field']->fieldDB->value) ? '' : $data['field']->fieldDB->value, |
| 156 |
[ |
| 157 |
'class' => 'acym__fields__edit__select acym__fields__database__columns acym__select', |
| 158 |
'acym-data-infinite' => true, |
| 159 |
], |
| 160 |
'value', |
| 161 |
'name', |
| 162 |
null, |
| 163 |
false, |
| 164 |
true |
| 165 |
); |
| 166 |
?> |
| 167 |
</label> |
| 168 |
<div class="medium-1"></div> |
| 169 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_TITLE')); ?> |
| 170 |
<?php |
| 171 |
acym_select( |
| 172 |
empty($data['field']->fieldDB->columns) ? [] : $data['field']->fieldDB->columns, |
| 173 |
'fieldDB[title]', |
| 174 |
empty($data['field']->fieldDB->title) ? '' : $data['field']->fieldDB->title, |
| 175 |
[ |
| 176 |
'class' => 'acym__fields__edit__select acym__fields__database__columns acym__select', |
| 177 |
'acym-data-infinite' => true, |
| 178 |
], |
| 179 |
'value', |
| 180 |
'name', |
| 181 |
null, |
| 182 |
false, |
| 183 |
true |
| 184 |
); |
| 185 |
?> |
| 186 |
</label> |
| 187 |
<label class="cell margin-top-1 medium-4"><?php echo esc_html(acym_translation('ACYM_WHERE')); ?> |
| 188 |
<?php |
| 189 |
acym_select( |
| 190 |
empty($data['field']->fieldDB->columns) ? [] : $data['field']->fieldDB->columns, |
| 191 |
'fieldDB[where]', |
| 192 |
empty($data['field']->fieldDB->where) ? '' : $data['field']->fieldDB->where, |
| 193 |
[ |
| 194 |
'class' => 'acym__fields__edit__select acym__fields__database__columns acym__select', |
| 195 |
'acym-data-infinite' => true, |
| 196 |
], |
| 197 |
'value', |
| 198 |
'name', |
| 199 |
null, |
| 200 |
false, |
| 201 |
true |
| 202 |
); |
| 203 |
?> |
| 204 |
</label> |
| 205 |
<label class="cell margin-top-1 medium-3 margin-left-1 margin-right-1"> |
| 206 |
<?php echo esc_html(acym_translation('ACYM_WHERE_OPERATION')); ?> |
| 207 |
<?php |
| 208 |
$data['operatorType']->display( |
| 209 |
'fieldDB[where_sign]', |
| 210 |
empty($data['field']->fieldDB->where_sign) ? '' : $data['field']->fieldDB->where_sign, |
| 211 |
'acym__fields__edit__select acym__select', |
| 212 |
true |
| 213 |
); |
| 214 |
?> |
| 215 |
</label> |
| 216 |
<label class="cell margin-top-1 medium-4"><?php echo esc_html(acym_translation('ACYM_WHERE_VALUE')); ?> |
| 217 |
<input type="text" |
| 218 |
name="fieldDB[where_value]" |
| 219 |
class="margin-bottom-0" |
| 220 |
value="<?php echo isset($data['field']->fieldDB->where_value) && strlen($data['field']->fieldDB->where_value) > 0 ? esc_attr( |
| 221 |
$data['field']->fieldDB->where_value |
| 222 |
) : ''; ?>"> |
| 223 |
</label> |
| 224 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_ORDER_BY')); ?> |
| 225 |
<?php |
| 226 |
acym_select( |
| 227 |
empty($data['field']->fieldDB->columns) ? [] : $data['field']->fieldDB->columns, |
| 228 |
'fieldDB[order_by]', |
| 229 |
empty($data['field']->fieldDB->order_by) ? '' : $data['field']->fieldDB->order_by, |
| 230 |
[ |
| 231 |
'class' => 'acym__fields__edit__select acym__fields__database__columns acym__select', |
| 232 |
'acym-data-infinite' => true, |
| 233 |
], |
| 234 |
'value', |
| 235 |
'name', |
| 236 |
null, |
| 237 |
false, |
| 238 |
true |
| 239 |
); |
| 240 |
?> |
| 241 |
</label> |
| 242 |
<div class="medium-1"></div> |
| 243 |
<label class="cell margin-top-1 medium-5"><?php echo esc_html(acym_translation('ACYM_SORT_ORDERING')); ?> |
| 244 |
<?php |
| 245 |
acym_select( |
| 246 |
['asc' => 'ASC', 'desc' => 'DESC'], |
| 247 |
'fieldDB[sort_order]', |
| 248 |
empty($data['field']->fieldDB->sort_order) ? '' : $data['field']->fieldDB->sort_order, |
| 249 |
[ |
| 250 |
'class' => 'acym__fields__edit__select acym__select', |
| 251 |
'acym-data-infinite' => true, |
| 252 |
], |
| 253 |
'value', |
| 254 |
'name', |
| 255 |
null, |
| 256 |
false, |
| 257 |
true |
| 258 |
); |
| 259 |
?> |
| 260 |
</label> |
| 261 |
</div> |
| 262 |
|