本文整理汇总了PHP中HTML_QuickForm2_Renderer::renderLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2_Renderer::renderLabel方法的具体用法?PHP HTML_QuickForm2_Renderer::renderLabel怎么用?PHP HTML_QuickForm2_Renderer::renderLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm2_Renderer
的用法示例。
在下文中一共展示了HTML_QuickForm2_Renderer::renderLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderGroup
public static function _renderGroup(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Group $group)
{
$error = $group->getError();
if ($error) {
$html[] = '<div class="form-group error">';
$renderer->errors[] = $error;
} else {
$html[] = '<div class="form-group">';
}
$html[] = "\n";
$html[] = $renderer->renderLabel($group);
$html[] = '<div class="form-control">';
// $html[] = '<div class="input inline">';
$html[] = "\n";
$separator = $group->getSeparator();
/*
foreach ($group as $element) {
echo '<pre>';
var_dump($element);
echo '</pre>';
//$elements[] = (string)$element;
}
*/
/*
$elements[] = (string)array_pop($group->getElements());
echo '<pre>';
//var_dump($elements);
echo '</pre>';
/*
foreach($elements as $k => $v)
{
$elements[$k] = (string)$elements[$k];
}*/
/*
echo '<pre>';
//var_dump($elements);
echo '</pre>';
*/
$elements = array_pop($renderer->html);
if (!is_array($separator)) {
$content = implode((string) $separator, $elements);
} else {
$content = '';
$cSeparator = count($separator);
for ($i = 0, $count = count($elements); $i < $count; $i++) {
$content .= (0 == $i ? '' : $separator[($i - 1) % $cSeparator]) . $elements[$i];
}
}
$html[] = $content;
if ($error) {
$html[] = '<span class="help-inline">' . $error . '</span>';
} else {
$label = $group->getLabel();
if (is_array($label) && !empty($label[1])) {
$html[] = '<span class="help-block">' . $label[1] . '</span>';
}
}
$html[] = "\n";
// $html[] = '</div>';
$html[] = '</div>';
$html[] = '</div><!-- of group -->';
return implode('', $html);
/*
$break = HTML_Common2::getOption('linebreak');
//$html[] = '<div class="row">';
$error = $group->getError();
if ($error) {
$html[] = '<div class="form-inline control-group error">';
$html[] = $renderer->renderLabel($group);
if ($renderer->getOption('group_errors')) {
$renderer->errors[] = $error;
} else {
$html[] = '<span class="help-inline">'.$error.'</span><br />';
}
} else {
$html[] = '<span class="form-inline">';
$html[] = $renderer->renderLabel($group);
}
$separator = $group->getSeparator();
$elements = array_pop($renderer->html);
if (!is_array($separator)) {
$content = implode((string)$separator, $elements);
} else {
$content = '';
$cSeparator = count($separator);
for ($i = 0, $count = count($elements); $i < $count; $i++) {
$content .= (0 == $i? '': $separator[($i - 1) % $cSeparator]) .
$elements[$i];
}
}
$html[] = $content;
$html[] = '</span>';
//$html[] = '</div>';
return implode($break, $html) . $break;
*/
}
示例2: _renderGroup
public static function _renderGroup(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Group $group)
{
$break = HTML_Common2::getOption('linebreak');
$html[] = '<div class="row">';
$html[] = $renderer->renderLabel($group);
$error = $group->getError();
if ($error) {
$html[] = '<div class="element group error">';
if ($renderer->getOption('group_errors')) {
$renderer->errors[] = $error;
} else {
$html[] = '<span class="error">' . $error . '</span><br />';
}
} else {
$html[] = '<div class="element group">';
}
$separator = $group->getSeparator();
$elements = array_pop($renderer->html);
if (!is_array($separator)) {
$content = implode((string) $separator, $elements);
} else {
$content = '';
$cSeparator = count($separator);
for ($i = 0, $count = count($elements); $i < $count; $i++) {
$content .= (0 == $i ? '' : $separator[($i - 1) % $cSeparator]) . $elements[$i];
}
}
$html[] = $content;
$html[] = '</div>';
$html[] = '</div>';
return implode($break, $html) . $break;
}