createInputList() публичный статический Метод

public static createInputList ( array $items, array $inputAttrs = NULL, array $labelAttrs = NULL, $wrapper = NULL ) : string
$items array
$inputAttrs array
$labelAttrs array
Результат string
Пример #1
0
 /**
  * Generates control's HTML element.
  * @return string
  */
 public function getControl()
 {
     $items = $this->getItems();
     reset($items);
     $input = parent::getControl();
     return Nette\Forms\Helpers::createInputList($this->translate($items), array_merge($input->attrs, array('id' => NULL, 'checked?' => $this->value, 'disabled:' => $this->disabled, 'required' => NULL, 'data-nette-rules:' => array(key($items) => $input->attrs['data-nette-rules']))), $this->label->attrs, $this->separator);
 }
Пример #2
0
	/**
	 * Generates control's HTML element.
	 * @return Html
	 */
	public function getControl($key = NULL)
	{
		if ($key !== NULL) {
			trigger_error(sprintf('Partial %s() is deprecated; use getControlPart() instead.', __METHOD__), E_USER_DEPRECATED);
			return $this->getControlPart($key);
		}

		$input = parent::getControl();
		$ids = array();
		foreach ($this->getItems() as $value => $label) {
			$ids[$value] = $input->id . '-' . $value;
		}

		return $this->container->setHtml(
			Nette\Forms\Helpers::createInputList(
				$this->translate($this->getItems()),
				array_merge($input->attrs, array(
					'id:' => $ids,
					'checked?' => $this->value,
					'disabled:' => $this->disabled,
					'data-nette-rules:' => array(key($ids) => $input->attrs['data-nette-rules']),
				)),
				array('for:' => $ids) + $this->itemLabel->attrs,
				$this->separator
			)
		);
	}
Пример #3
0
 /**
  * Generates control's HTML element.
  *
  * @return string
  */
 public function getControl()
 {
     $items = $this->getItems();
     reset($items);
     $input = BaseControl::getControl();
     return Helpers::createInputList($this->translate ? $this->translate($items) : $items, array_merge($input->attrs, ['id' => NULL, 'checked?' => $this->value, 'disabled:' => $this->disabled, 'required' => NULL, 'data-nette-rules:' => [key($items) => $input->attrs['data-nette-rules']]]), $this->label->attrs, $this->separator);
 }
Пример #4
0
 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     $input = parent::getControl();
     $items = $this->getItems();
     $ids = [];
     if ($this->generateId) {
         foreach ($items as $value => $label) {
             $ids[$value] = $input->id . '-' . $value;
         }
     }
     return $this->container->setHtml(Nette\Forms\Helpers::createInputList($this->translate($items), array_merge($input->attrs, ['id:' => $ids, 'checked?' => $this->value, 'disabled:' => $this->disabled, 'data-nette-rules:' => [key($items) => $input->attrs['data-nette-rules']]]), ['for:' => $ids] + $this->itemLabel->attrs, $this->separator));
 }
Пример #5
0
 /**
  * Generates control's HTML element.
  * @param  mixed
  * @return Nette\Utils\Html
  */
 public function getControl($key = NULL)
 {
     $input = parent::getControl();
     if ($key !== NULL) {
         $selected = array_flip((array) $this->value);
         return $input->addAttributes(array('id' => $input->id . '-' . $key, 'checked' => isset($selected[$key]), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'value' => $key));
     }
     $ids = $items = array();
     foreach ($this->items as $value => $label) {
         $items[$value] = $this->translate($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->label->attrs, $this->separator));
 }