/** * Generates control's HTML element. * @return Nette\Utils\Html */ public function getControl() { $items = $this->prompt === FALSE ? array() : array('' => $this->translate($this->prompt)); foreach ($this->options as $key => $value) { $items[is_array($value) ? $this->translate($key) : $key] = $this->translate($value); } return Nette\Forms\Helpers::createSelectBox($items, array('selected?' => $this->value, 'disabled:' => is_array($this->disabled) ? $this->disabled : NULL))->addAttributes(parent::getControl()->attrs); }
/** * Just remove translations from each option * @return Nette\Forms\Helpers */ public function getControl() { $input = ChoiceControl::getControl(); $items = $this->getItems(); $ids = array(); if ($this->generateId) { foreach ($items as $value => $label) { $ids[$value] = $input->id . '-' . $value; } } return $this->container->setHtml(Nette\Forms\Helpers::createInputList($items, array_merge($input->attrs, array('id:' => $ids, 'checked?' => $this->value, 'disabled:' => $this->disabled, 'data-nette-rules:' => array(key($items) => $input->attrs['data-nette-rules']))), array('for:' => $ids) + $this->itemLabel->attrs, $this->separator)); }
/** * @return Html */ public function getControlPart($key = NULL) { $key = key([(string) $key => NULL]); return parent::getControl()->addAttributes(['id' => $this->getHtmlId() . '-' . $key, 'checked' => in_array($key, (array) $this->value, TRUE), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'value' => $key]); }
/** * @return Nette\Utils\Html */ public function getControlPart($key) { return parent::getControl()->addAttributes(array('id' => $this->getHtmlId() . '-' . $key, 'checked' => in_array($key, (array) $this->value), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'value' => $key)); }