Nette\Forms\Controls\SelectBox::getControl PHP Method

getControl() public method

Generates control's HTML element.
public getControl ( ) : Nette\Utils\Html
return Nette\Utils\Html
    public function getControl()
    {
        $items = $this->prompt === FALSE ? [] : ['' => $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, ['selected?' => $this->value, 'disabled:' => is_array($this->disabled) ? $this->disabled : NULL] + $this->optionAttributes)->addAttributes(parent::getControl()->attrs);
    }

Usage Example

Example #1
0
 public function getControl()
 {
     $control = parent::getControl();
     $control->{'data-linkedelement'} = $this->linkedElement;
     $control->{'data-linkedproperty'} = $this->linkedProperty;
     return $control;
 }
All Usage Examples Of Nette\Forms\Controls\SelectBox::getControl