| 1 |
<?php $this->layout('layouts/default'); ?> |
| 2 |
|
| 3 |
<?php foreach ($fields ?? [] as $name => $section) : ?> |
| 4 |
<?php if ($section['title'] ?? false) : ?> |
| 5 |
<h3><?php echo esc_html($section['title']) ?></h3> |
| 6 |
<?php endif; ?> |
| 7 |
<?php if ($section['subtitle'] ?? false) : ?> |
| 8 |
<p><?php echo esc_html($section['subtitle']) ?></p> |
| 9 |
<?php endif; ?> |
| 10 |
<table class="form-table" <?php echo html_build_attributes($section['condition'] ?? []) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> |
| 11 |
<?php foreach ($section['fields'] ?? [] as $name => $field) : ?> |
| 12 |
<tr <?php echo html_build_attributes($field['condition'] ?? []) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> |
| 13 |
<th> |
| 14 |
<?php echo esc_html($field['label']) ?> |
| 15 |
<?php if ($field['sublabel'] ?? false) : ?> |
| 16 |
<sup>(<?php echo esc_html($field['sublabel']) ?>)</sup> |
| 17 |
<?php endif; ?> |
| 18 |
</th> |
| 19 |
<td> |
| 20 |
<fieldset class="ag-fields ag-fields--<?php esc_attr($field['type']) ?>"> |
| 21 |
|
| 22 |
<?php |
| 23 |
try { |
| 24 |
$this->insert('partials/fields/' . $field['type'], ['name' => $name, 'field' => $field]); |
| 25 |
} catch (Exception $e) { |
| 26 |
// dump($e->getMessage()); |
| 27 |
$this->insert('partials/fields/input', ['name' => $name, 'field' => $field]); |
| 28 |
} |
| 29 |
|
| 30 |
if ($field['translate'] ?? false) { |
| 31 |
foreach ($languages['available'] ?? [] as $code => $lang) { |
| 32 |
$langName = $code . '.' . $name; |
| 33 |
|
| 34 |
if ($field['attributes']['required'] ?? false) { |
| 35 |
unset($field['attributes']['required']); |
| 36 |
} |
| 37 |
|
| 38 |
try { |
| 39 |
$this->insert('partials/fields/'.$field['type'], ['name' => $langName, 'field' => $field, 'lang' => $code]); |
| 40 |
} catch (Exception $e) { |
| 41 |
$this->insert('partials/fields/input', ['name' => $langName, 'field' => $field, 'lang' => $code]); |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
?> |
| 47 |
</fieldset> |
| 48 |
<?php if ($field['docs'] ?? false) : ?> |
| 49 |
<a href="<?php echo esc_url($field['docs']['link'] ?? '#') ?>" class="<?php echo esc_attr($field['docs']['class'] ?? 'button') ?> ag-docs-link" target="_blank" rel="noopener noreferrer"><?php echo esc_html($field['docs']['label'] ?? __('Documentation', 'age-gate')) ?> <span class="dashicons dashicons-external"></span></a> |
| 50 |
<?php endif; ?> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
<?php endforeach; ?> |
| 54 |
</table> |
| 55 |
<hr /> |
| 56 |
<?php endforeach; ?> |
| 57 |
|
| 58 |
|
| 59 |
<?php $this->start('after') ?> |
| 60 |
<?php echo $this->section('additional') // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 61 |
<?php $this->stop() ?> |
| 62 |
|