| 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"><?php echo esc_html(acym_translation('ACYM_INFORMATION')); ?></h2> |
| 6 |
<?php |
| 7 |
if (!empty($data['translation_languages'])) { |
| 8 |
acym_displayLanguageRadio( |
| 9 |
$data['translation_languages'], |
| 10 |
'field[translation]', |
| 11 |
empty($data['field']->translation) ? '' : $data['field']->translation, |
| 12 |
acym_translation('ACYM_LANGUAGE_CUSTOM_FIELD_DESC'), |
| 13 |
'', |
| 14 |
'field' |
| 15 |
); |
| 16 |
} ?> |
| 17 |
<label class="cell xlarge-12 large-6 margin-top-1"> |
| 18 |
<?php echo esc_html(acym_translation('ACYM_NAME')); ?> |
| 19 |
<input required type="text" name="field[name]" value="<?php echo empty($data['field']->name) ? '' : esc_attr($data['field']->name); ?>"> |
| 20 |
</label> |
| 21 |
<label class="cell xlarge-12 large-6 margin-top-1"> |
| 22 |
<?php |
| 23 |
echo esc_html(acym_translation('ACYM_FIELD_TYPE')); |
| 24 |
|
| 25 |
$attributes = [ |
| 26 |
'acym-data-infinite' => true, |
| 27 |
'class' => 'acym__fields__edit__select acym__select', |
| 28 |
]; |
| 29 |
if (!empty($data['field']->id) && in_array($data['field']->id, [1, 2, $data['languageFieldId']])) { |
| 30 |
$attributes['disabled'] = true; |
| 31 |
} |
| 32 |
|
| 33 |
acym_select( |
| 34 |
$data['fieldType'], |
| 35 |
'field[type]', |
| 36 |
$data['field']->type, |
| 37 |
$attributes, |
| 38 |
'value', |
| 39 |
'name', |
| 40 |
null, |
| 41 |
false, |
| 42 |
true |
| 43 |
); |
| 44 |
?> |
| 45 |
</label> |
| 46 |
|
| 47 |
<div class="cell large-12 grid-x margin-top-1"> |
| 48 |
<?php |
| 49 |
$disableActiveSwitch = !empty($data['field']->core) || in_array($data['field']->id, [2, $data['languageFieldId']]); |
| 50 |
|
| 51 |
acym_switch([ |
| 52 |
'name' => 'field[active]', |
| 53 |
'value' => $data['field']->active, |
| 54 |
'label' => acym_translation('ACYM_ACTIVE'), |
| 55 |
'labelClass' => 'auto', |
| 56 |
'switchContainerClass' => 'shrink', |
| 57 |
'switchClass' => 'margin-0', |
| 58 |
'disabled' => $disableActiveSwitch, |
| 59 |
]); ?> |
| 60 |
</div> |
| 61 |
|
| 62 |
<?php if (empty($data['field']->id) || !in_array($data['field']->id, [2, $data['languageFieldId']])) { ?> |
| 63 |
<div class="cell large-12 grid-x acym__fields__change margin-top-1" id="acym__fields__required"> |
| 64 |
<?php |
| 65 |
acym_switch([ |
| 66 |
'name' => 'field[required]', |
| 67 |
'value' => $data['field']->required, |
| 68 |
'label' => acym_translation('ACYM_REQUIRED'), |
| 69 |
'tip' => ['textShownInTooltip' => 'ACYM_REQUIRED_DESC'], |
| 70 |
'labelClass' => 'auto', |
| 71 |
'switchContainerClass' => 'shrink', |
| 72 |
'switchClass' => 'margin-0', |
| 73 |
'toggle' => 'required_error_message', |
| 74 |
]); ?> |
| 75 |
</div> |
| 76 |
<div class="cell margin-top-1 large-11" id="required_error_message"> |
| 77 |
<label class="acym__fields__change" id="acym__fields__error-message"> |
| 78 |
<?php echo esc_html(acym_translation('ACYM_CUSTOM_ERROR')); ?> |
| 79 |
<input type="text" |
| 80 |
name="field[option][error_message]" |
| 81 |
value="<?php echo empty($data['field']->option->error_message) ? '' : esc_attr($data['field']->option->error_message); ?>" |
| 82 |
placeholder="<?php echo esc_attr(acym_translationSprintf('ACYM_DEFAULT_REQUIRED_MESSAGE', 'xxx')); ?>"> |
| 83 |
</label> |
| 84 |
</div> |
| 85 |
<?php } ?> |
| 86 |
|