|
|
|
@ -241,7 +241,7 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer |
|
|
|
|
* @see renderElement() |
|
|
|
|
* @return string Html for element |
|
|
|
|
*/ |
|
|
|
|
function _prepareTemplate($name, $label, $required, $error) |
|
|
|
|
function _prepareTemplate($name, $label, $required, $error, $labelFor = '') |
|
|
|
|
{ |
|
|
|
|
if (is_array($label)) { |
|
|
|
|
$nameLabel = array_shift($label); |
|
|
|
@ -251,8 +251,10 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer |
|
|
|
|
|
|
|
|
|
if (isset($this->_templates[$name])) { |
|
|
|
|
$html = str_replace('{label}', $nameLabel, $this->_templates[$name]); |
|
|
|
|
$html = str_replace('{label-for}', $labelFor, $this->_templates[$name]); |
|
|
|
|
} else { |
|
|
|
|
$html = str_replace('{label}', $nameLabel, $this->_elementTemplate); |
|
|
|
|
$html = str_replace('{label-for}', $labelFor, $this->_elementTemplate); |
|
|
|
|
} |
|
|
|
|
if ($required) { |
|
|
|
|
$html = str_replace('<!-- BEGIN required -->', '', $html); |
|
|
|
@ -295,10 +297,11 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer |
|
|
|
|
*/ |
|
|
|
|
function renderElement(&$element, $required, $error) { |
|
|
|
|
if (!$this->_inGroup) { |
|
|
|
|
$html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error); |
|
|
|
|
$html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error, $element->getLabelFor()); |
|
|
|
|
$this->_html .= str_replace('{element}', $element->toHtml(), $html); |
|
|
|
|
} elseif (!empty($this->_groupElementTemplate)) { |
|
|
|
|
$html = str_replace('{label}', $element->getLabel(), $this->_groupElementTemplate); |
|
|
|
|
$html = str_replace('{label-for}', $element->getLabelFor(), $this->_groupElementTemplate); |
|
|
|
|
if ($required) { |
|
|
|
|
$html = str_replace('<!-- BEGIN required -->', '', $html); |
|
|
|
|
$html = str_replace('<!-- END required -->', '', $html); |
|
|
|
|