default.php
3 days ago
default_api.php
3 days ago
default_api_basic.php
3 days ago
default_api_users.php
3 days ago
default_backup.php
3 days ago
default_backup_basic.php
3 days ago
default_customizer.php
3 days ago
default_customizer_addcss.php
3 days ago
default_customizer_form.php
3 days ago
default_customizer_preview.php
3 days ago
default_customizer_toolbar.php
3 days ago
default_webhooks.php
3 days ago
default_webhooks_basic.php
3 days ago
index.html
3 days ago
default_customizer_form.php
79 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | $vik = VAPApplication::getInstance(); |
| 15 | |
| 16 | // build layout used to render the parameters form |
| 17 | $formLayout = new JLayoutFile('form.fields'); |
| 18 | |
| 19 | foreach ($this->customizerNode as $k => $fields) |
| 20 | { |
| 21 | $fieldset_lang_key = 'VAP_CUSTOMIZER_FIELDSET_' . strtoupper($k); |
| 22 | |
| 23 | // attempt to translate parameter label |
| 24 | $fieldset_label = JText::translate($fieldset_lang_key); |
| 25 | |
| 26 | if ($fieldset_label === $fieldset_lang_key) |
| 27 | { |
| 28 | // prettify default name |
| 29 | $fieldset_label = ucfirst($k); |
| 30 | } |
| 31 | |
| 32 | $params = []; |
| 33 | |
| 34 | foreach ($fields as $name => $field) |
| 35 | { |
| 36 | $lang_key = 'VAP_CUSTOMIZER_PARAM_' . strtoupper($name); |
| 37 | |
| 38 | // attempt to translate parameter label |
| 39 | $label = JText::translate($lang_key); |
| 40 | |
| 41 | if ($label === $lang_key) |
| 42 | { |
| 43 | // prettify default name |
| 44 | $label = ucwords(str_replace('_', ' ', $name)); |
| 45 | } |
| 46 | |
| 47 | $params[$name] = [ |
| 48 | 'type' => $field['type'], |
| 49 | 'name' => 'customizer[' . $field['key'] . ']', |
| 50 | 'value' => $field['val'], |
| 51 | 'label' => $label, |
| 52 | 'preview' => true, |
| 53 | ]; |
| 54 | } |
| 55 | |
| 56 | ?> |
| 57 | <div class="config-fieldset full-width"> |
| 58 | |
| 59 | <div class="config-fieldset-head"> |
| 60 | <h3><?php echo $fieldset_label; ?></h3> |
| 61 | </div> |
| 62 | |
| 63 | <div class="config-fieldset-body"> |
| 64 | <?php |
| 65 | // render parameters form |
| 66 | echo $formLayout->render(['fields' => $params]); |
| 67 | ?> |
| 68 | |
| 69 | <!-- RESTORE - Button --> |
| 70 | |
| 71 | <?php echo $vik->openControl(''); ?> |
| 72 | <button type="button" class="btn restore-customizer-settings"><?php echo JText::translate('VAPRESTORE'); ?></button> |
| 73 | <?php echo $vik->closeControl(); ?> |
| 74 | </div> |
| 75 | |
| 76 | </div> |
| 77 | <?php |
| 78 | } |
| 79 |