open.php
51 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments - Libraries |
| 4 | * @subpackage html.form |
| 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 | $label = isset($displayData['label']) ? $displayData['label'] : ''; |
| 15 | $desc = isset($displayData['description']) ? $displayData['description'] : ''; |
| 16 | $id = isset($displayData['id']) ? $displayData['id'] : null; |
| 17 | $ctrlId = isset($displayData['idparent']) ? $displayData['idparent'] : null; |
| 18 | $req = isset($displayData['required']) ? $displayData['required'] : 0; |
| 19 | $class = isset($displayData['class']) ? ' ' . $displayData['class'] : ''; |
| 20 | $style = isset($displayData['style']) ? $displayData['style'] : ''; |
| 21 | |
| 22 | $label = JText::translate($label); |
| 23 | |
| 24 | // remove trailing "colon" if already specified by the translation |
| 25 | $label = rtrim($label, ':'); |
| 26 | // remove trailing "*" if already specified by the translation (only if required) |
| 27 | $label = $req ? rtrim($label, '*') : $label; |
| 28 | |
| 29 | if (!empty($desc)) |
| 30 | { |
| 31 | $label = VAPApplication::getInstance()->textPopover(array( |
| 32 | 'title' => $label, |
| 33 | 'content' => JText::translate($desc), |
| 34 | )); |
| 35 | } |
| 36 | |
| 37 | // Add '*' only if there is plain text. |
| 38 | // For example, in case of <a><i></i></a>, we don't |
| 39 | // need to proceed. |
| 40 | if ($label && strip_tags($label)) |
| 41 | { |
| 42 | $label .= ($req ? '*' : ''); |
| 43 | } |
| 44 | |
| 45 | ?> |
| 46 | <div class="control<?php echo $class; ?>"<?php echo ($ctrlId ? ' id="' . $ctrlId . '"' : ''); ?><?php echo ($style ? ' style="' . $style . '"' : ''); ?>> |
| 47 | <label |
| 48 | <?php echo $id ? 'for="' . esc_attr($id) . '"' : ''; ?> |
| 49 | ><?php echo $label; ?></label> |
| 50 | <div class="control-value"> |
| 51 |