public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; $options = $this->options; if (count($options) == 0) { $options = Service::get('database.manager')->model($this->name_model_relation)->getForOptions(); } return \Kodazzi\Helper\FormHtml::select($format, $options, $this->value, null, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; if ($this->type_field_tag === 'radio') { $string = ''; foreach ($this->options as $value => $name) { $string .= '<span class="radio">'; $string .= '<label for="' . $id . '_' . $value . '">' . $name . '</label>'; $string .= \Kodazzi\Helper\FormHtml::radio($format, $value, $this->value == null ? $this->default && $this->default == $value ? true : false : ($value == $this->value ? true : false), array('id' => $id . '_' . $value, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); $string .= '</span>'; } return $string; } return \Kodazzi\Helper\FormHtml::select($format, $this->options, $this->value == null ? $this->default : $this->value, null, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); }