Ejemplo n.º 1
0
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     $name = $this->getFieldName();
     $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue();
     $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix);
     $store = $this->_getStoreData();
     if ($this->getShowNoSelection()) {
         array_unshift($store['data'], array('', '(' . trlKwf('no selection') . ')'));
     }
     $ret['html'] = '<div class="kwfFormFieldRadio kwfFormFieldRadio' . ucfirst($this->getOutputType()) . '">';
     $k = 0;
     foreach ($store['data'] as $i) {
         $ret['html'] .= '<span class="value' . htmlspecialchars(ucfirst($i[0])) . '">';
         $ret['html'] .= '<input type="radio" class="radio" id="' . $ret['id'] . ++$k . '" ' . 'name="' . $name . $fieldNamePostfix . '" value="' . htmlspecialchars($i[0]) . '"';
         if ($value === $i[0] || !is_null($value) && $i[0] == $value) {
             $ret['html'] .= ' checked="checked"';
         }
         $ret['html'] .= ' /> <label for="' . $ret['id'] . $k . '">' . htmlspecialchars($i[1]) . '</label>';
         $ret['html'] .= '</span>';
     }
     $ret['html'] .= '</div>';
     return $ret;
 }
 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $this->setSubmitOnChange(true);
     return parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
 }