Пример #1
0
 private function renderRadio(Radio $element)
 {
     $label = $this->getView()->translate($element->getLabel());
     $result = '<div class="zui-field-group">';
     $result .= '<span class="zui-form-label">' . $this->getView()->escapeHtml($label) . '</span>';
     $result .= '<div class="zui-field-group-inner">';
     foreach ($element->getValueOptions() as $key => $value) {
         $id = uniqid('zui', false);
         $result .= '<div>';
         if ($element->getValue() == $key) {
             $checked = ' checked="checked"';
         } else {
             $checked = '';
         }
         $result .= sprintf('<input type="radio" name="%s" id="%s" value="%s"%s>', $this->getView()->escapeHtmlAttr($element->getName()), $this->getView()->escapeHtmlAttr($id), $this->getView()->escapeHtmlAttr($key), $checked);
         $result .= '<label for="' . $id . '">' . $this->getView()->escapeHtml($value) . '</label>';
         $result .= '</div>';
     }
     $result .= '</div>';
     $result .= $this->getView()->zourceFormDescription($element);
     $result .= $this->getView()->formElementErrors($element);
     $result .= '</div>';
     return $result . '</fieldset>';
 }