| 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"> |
| 11 |
<?php foreach ($section['fields'] ?? [] as $name => $field) : ?> |
| 12 |
<tr> |
| 13 |
<th><?php echo esc_html($field['label']) ?></th> |
| 14 |
<td> |
| 15 |
<fieldset class="ag-fields ag-fields--<?php echo esc_attr($field['type']) ?>"> |
| 16 |
|
| 17 |
<?php |
| 18 |
try { |
| 19 |
$this->insert('partials/fields/' . $field['type'], ['name' => $name, 'field' => $field]); |
| 20 |
} catch (Exception $e) { |
| 21 |
$this->insert('partials/fields/input', ['name' => $name, 'field' => $field]); |
| 22 |
} |
| 23 |
|
| 24 |
if ($field['translate'] ?? false) { |
| 25 |
foreach ($languages['available'] ?? [] as $code => $lang) { |
| 26 |
$langName = $code . '.' . $name; |
| 27 |
|
| 28 |
try { |
| 29 |
$this->insert('partials/fields/'.$field['type'], ['name' => $langName, 'field' => $field, 'lang' => $code]); |
| 30 |
} catch (Exception $e) { |
| 31 |
$this->insert('partials/fields/input', ['name' => $langName, 'field' => $field, 'lang' => $code]); |
| 32 |
} |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
?> |
| 37 |
|
| 38 |
</fieldset> |
| 39 |
|
| 40 |
<?php echo esc_html($field['type']) ?> |
| 41 |
</td> |
| 42 |
</tr> |
| 43 |
<?php endforeach; ?> |
| 44 |
</table> |
| 45 |
<hr /> |
| 46 |
<?php endforeach; ?> |
| 47 |
|