| 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 acym__fields__edit__section__title" |
| 6 |
id="acym__fields__edit__section__title--content"> |
| 7 |
<?php echo esc_html(acym_translation('ACYM_FIELD_CONTENT')); ?> |
| 8 |
</h2> |
| 9 |
|
| 10 |
<label class="cell large-6 acym__fields__change" id="acym__fields__default-value"> |
| 11 |
<?php echo esc_html(acym_translation('ACYM_DEFAULT_VALUE')); ?> |
| 12 |
<input type="text" name="field[default_value]" |
| 13 |
value="<?php echo isset($data['field']->default_value) ? esc_attr($data['field']->default_value) : ''; ?>"> |
| 14 |
</label> |
| 15 |
|
| 16 |
<div class="cell acym__fields__change" id="acym__fields__authorized-content"> |
| 17 |
<label><?php echo esc_html(acym_translation('ACYM_AUTHORIZED_CONTENT')); ?></label> |
| 18 |
<?php |
| 19 |
$regex = empty($data['field']->option->authorized_content->regex) ? '' : $data['field']->option->authorized_content->regex; |
| 20 |
|
| 21 |
$authorizedContent = ['all' => acym_translation('ACYM_ALL')]; |
| 22 |
if ($data['field']->id != 2) { |
| 23 |
$authorizedContent['number'] = acym_translation('ACYM_NUMBER_ONLY'); |
| 24 |
$authorizedContent['letters'] = acym_translation('ACYM_LETTERS_ONLY'); |
| 25 |
$authorizedContent['numbers_letters'] = acym_translation('ACYM_NUMBERS_LETTERS_ONLY'); |
| 26 |
} |
| 27 |
$placeholder = acym_translation('ACYM_REGULAR_EXPRESSION'); |
| 28 |
$authorizedContent['regex'] = ' <input type="text" |
| 29 |
value="'.esc_attr($regex).'" |
| 30 |
name="field[option][authorized_content][regex]" |
| 31 |
placeholder="'.esc_attr($placeholder).'">'; |
| 32 |
|
| 33 |
acym_radio( |
| 34 |
$authorizedContent, |
| 35 |
'field[option][authorized_content][]', |
| 36 |
empty($data['field']->option->authorized_content->{'0'}) ? 'all' : $data['field']->option->authorized_content->{'0'} |
| 37 |
); |
| 38 |
?> |
| 39 |
</div> |
| 40 |
|
| 41 |
<!--if the user didn't respect the authorized content then we display the message below--> |
| 42 |
<label class="cell large-6 acym__fields__change" id="acym__fields__error-message-invalid"> |
| 43 |
<?php echo esc_html(acym_translation('ACYM_ERROR_MESSAGE_INVALID_CONTENT')); ?> |
| 44 |
<input type="text" |
| 45 |
name="field[option][error_message_invalid]" |
| 46 |
value="<?php echo empty($data['field']->option->error_message_invalid) ? '' : esc_attr($data['field']->option->error_message_invalid); ?>"> |
| 47 |
</label> |
| 48 |
|
| 49 |
<label class="cell large-6 acym__fields__change" id="acym__fields__format"> |
| 50 |
<?php |
| 51 |
echo esc_html(acym_translation('ACYM_FORMAT')); |
| 52 |
acym_info( |
| 53 |
[ |
| 54 |
'textShownInTooltip' => acym_translationSprintf( |
| 55 |
'ACYM_X_TO_ENTER_X', |
| 56 |
'%d', |
| 57 |
acym_translation('ACYM_DAY') |
| 58 |
).'<br>'.acym_translationSprintf( |
| 59 |
'ACYM_X_TO_ENTER_X', |
| 60 |
'%m', |
| 61 |
acym_translation('ACYM_MONTH') |
| 62 |
).'<br>'.acym_translationSprintf( |
| 63 |
'ACYM_X_TO_ENTER_X', |
| 64 |
'%y', |
| 65 |
acym_translation('ACYM_YEAR') |
| 66 |
).'<br>'.acym_translation('ACYM_EXEMPLE_FORMAT'), |
| 67 |
] |
| 68 |
); |
| 69 |
?> |
| 70 |
<input type="text" name="field[option][format]" |
| 71 |
value="<?php echo empty($data['field']->option->format) ? '%d%m%y' : esc_attr($data['field']->option->format); ?>"> |
| 72 |
</label> |
| 73 |
|
| 74 |
<label class="cell acym__fields__change grid-x" id="acym__fields__max_characters"> |
| 75 |
<span class="cell"> |
| 76 |
<?php |
| 77 |
echo esc_html(acym_translation('ACYM_MAXIMUM_CHARACTERS')); |
| 78 |
acym_info(['textShownInTooltip' => 'ACYM_MAXIMUM_CHARACTERS_TOOLTIP']); |
| 79 |
?> |
| 80 |
</span> |
| 81 |
<input type="number" |
| 82 |
min="0" |
| 83 |
name="field[option][max_characters]" |
| 84 |
value="<?php echo empty($data['field']->option->max_characters) ? '' : esc_attr($data['field']->option->max_characters); ?>" |
| 85 |
class="cell medium-2 small-3"> |
| 86 |
</label> |
| 87 |
|