Nette\Forms\Container::addMultiSelect PHP Метод

addMultiSelect() публичный Метод

Adds select box control that allows multiple item selection.
public addMultiSelect ( $name, $label = NULL, array $items = NULL, $size = NULL ) : MultiSelectBox
$items array
Результат Nette\Forms\Controls\MultiSelectBox
    public function addMultiSelect($name, $label = NULL, array $items = NULL, $size = NULL)
    {
        return $this[$name] = (new Controls\MultiSelectBox($label, $items))->setAttribute('size', $size > 1 ? (int) $size : NULL);
    }

Usage Example

Пример #1
0
 /**
  * @param Nette\Forms\Container $container
  * @param string                $key
  * @param string                $name
  * @param array                $options
  * @return Nette\Forms\Controls\SelectBox
  */
 protected function addControl(Nette\Forms\Container $container, $key, $name, $options)
 {
     /**
      * Set some translated texts
      */
     $form = $container->lookup('Nette\\Application\\UI\\Form');
     $t = [$form->getTranslator(), 'translate'];
     $this->addAttribute('title', $t('ublaboo_datagrid.multiselect_choose'));
     $this->addAttribute('data-i18n-selected', $t('ublaboo_datagrid.multiselect_selected'));
     /**
      * Add input to container
      */
     $input = $container->addMultiSelect($key, $name, $options);
     return $this->addAttributes($input);
 }
All Usage Examples Of Nette\Forms\Container::addMultiSelect