1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Part of the Joomla Framework Form Package |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. |
6
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Joomla\Form; |
10
|
|
|
|
11
|
|
|
use Joomla\Language\Text; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Form Field class for the Joomla Framework. |
15
|
|
|
* Provides spacer markup to be used in form layouts. |
16
|
|
|
* |
17
|
|
|
* @since 1.0 |
18
|
|
|
* @deprecated The joomla/form package is deprecated |
19
|
|
|
*/ |
20
|
|
|
class Field_Spacer extends Field |
|
|
|
|
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* The form field type. |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
* @since 1.0 |
27
|
|
|
*/ |
28
|
|
|
protected $type = 'Spacer'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Method to get the field input markup for a spacer. |
32
|
|
|
* The spacer does not have accept input. |
33
|
|
|
* |
34
|
|
|
* @return string The field input markup. |
35
|
|
|
* |
36
|
|
|
* @since 1.0 |
37
|
|
|
*/ |
38
|
|
|
protected function getInput() |
39
|
|
|
{ |
40
|
|
|
return ' '; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Method to get the field label markup for a spacer. |
45
|
|
|
* Use the label text or name from the XML element as the spacer or |
46
|
|
|
* Use a hr="true" to automatically generate plain hr markup |
47
|
|
|
* |
48
|
|
|
* @return string The field label markup. |
49
|
|
|
* |
50
|
|
|
* @since 1.0 |
51
|
|
|
*/ |
52
|
|
|
protected function getLabel() |
53
|
|
|
{ |
54
|
|
|
$html = array(); |
55
|
|
|
$class = $this->element['class'] ? (string) $this->element['class'] : ''; |
56
|
|
|
|
57
|
|
|
$html[] = '<span class="spacer">'; |
58
|
|
|
$html[] = '<span class="before"></span>'; |
59
|
|
|
$html[] = '<span class="' . $class . '">'; |
60
|
|
|
|
61
|
|
|
if ((string) $this->element['hr'] == 'true') |
62
|
|
|
{ |
63
|
|
|
$html[] = '<hr class="' . $class . '" />'; |
64
|
|
|
} |
65
|
|
|
else |
66
|
|
|
{ |
67
|
|
|
$label = ''; |
68
|
|
|
|
69
|
|
|
// Get the label text from the XML element, defaulting to the element name. |
70
|
|
|
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; |
71
|
|
|
$text = $this->translateLabel ? Text::_($text) : $text; |
|
|
|
|
72
|
|
|
|
73
|
|
|
// Build the class for the label. |
74
|
|
|
$class = !empty($this->description) ? 'hasTip' : ''; |
75
|
|
|
$class = $this->required == true ? $class . ' required' : $class; |
|
|
|
|
76
|
|
|
|
77
|
|
|
// Add the opening label tag and main attributes attributes. |
78
|
|
|
$label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"'; |
79
|
|
|
|
80
|
|
|
// If a description is specified, use it to build a tooltip. |
81
|
|
View Code Duplication |
if (!empty($this->description)) |
|
|
|
|
82
|
|
|
{ |
83
|
|
|
$label .= ' title="' |
84
|
|
|
. htmlspecialchars( |
85
|
|
|
trim($text, ':') . '::' . ($this->translateDescription ? Text::_($this->description) : $this->description), |
|
|
|
|
86
|
|
|
ENT_COMPAT, 'UTF-8' |
87
|
|
|
) . '"'; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
// Add the label text and closing tag. |
91
|
|
|
$label .= '>' . $text . '</label>'; |
92
|
|
|
$html[] = $label; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
$html[] = '</span>'; |
96
|
|
|
$html[] = '<span class="after"></span>'; |
97
|
|
|
$html[] = '</span>'; |
98
|
|
|
|
99
|
|
|
return implode('', $html); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Method to get the field title. |
104
|
|
|
* |
105
|
|
|
* @return string The field title. |
106
|
|
|
* |
107
|
|
|
* @since 1.0 |
108
|
|
|
*/ |
109
|
|
|
protected function getTitle() |
110
|
|
|
{ |
111
|
|
|
return $this->getLabel(); |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.