PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / helpers / libraries / employee / area / fieldcontrol.php
vikappointments / site / helpers / libraries / employee / area Last commit date
controller.php 5 days ago fieldcontrol.php 5 days ago index.html 5 days ago manager.php 5 days ago toolbar.php 5 days ago
fieldcontrol.php
62 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 VAPLoader::import('libraries.customfields.control');
15
16 /**
17 * Employee area field control renderer.
18 *
19 * @since 1.7
20 */
21 class VAPEmployeAreaFieldControl implements VAPCustomFieldControl
22 {
23 /**
24 * Returns the HTML of the field.
25 *
26 * @param array $data An array of display data.
27 * @param string $input The HTML of the input to wrap.
28 *
29 * @return string The HTML of the input.
30 */
31 public function render($data, $input = null)
32 {
33 $vik = VAPApplication::getInstance();
34
35 // define control attributes
36 $attrs = array(
37 'id' => @$data['id'],
38 );
39
40 $label = @$data['label'];
41
42 // add required character
43 if ($label && !empty($data['required']))
44 {
45 $label .= '*';
46 }
47
48 // add description tooltip
49 if (!empty($data['description']))
50 {
51 $label .= $vik->createPopover(array(
52 'title' => @$data['label'],
53 'content' => $data['description'],
54 ));
55 }
56
57 // open control
58 return $vik->openControl($label, @$data['class'], $attrs)
59 . $input
60 . $vik->closeControl();
61 }
62 }