コード例 #1
0
 public static function _renderGroup(HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Group $group)
 {
     $break = HTML_Common2::getOption('linebreak');
     $class = $group->getAttribute('class');
     $html[] = '<div class="row' . (!empty($class) ? ' ' . $class : '') . '">';
     $html[] = $renderer->renderLabel($group);
     $error = $group->getError();
     if ($error) {
         $html[] = '<div class="element group error" id="' . $group->getId() . '">';
         if ($renderer->getOption('group_errors')) {
             $renderer->errors[] = $error;
         } else {
             $html[] = '<span class="error">' . $error . '</span><br />';
         }
     } else {
         $html[] = '<div class="element group" id="' . $group->getId() . '">';
     }
     $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;
 }