当前位置: 首页>>代码示例>>PHP>>正文


PHP Helpers::createInputList方法代码示例

本文整理汇总了PHP中Nette\Forms\Helpers::createInputList方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::createInputList方法的具体用法?PHP Helpers::createInputList怎么用?PHP Helpers::createInputList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Forms\Helpers的用法示例。


在下文中一共展示了Helpers::createInputList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getControl

 /**
  * 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);
 }
开发者ID:jave007,项目名称:test,代码行数:11,代码来源:CheckboxList.php

示例2: getControl

	/**
	 * 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
			)
		);
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:31,代码来源:RadioList.php

示例3: getControl

 /**
  * 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);
 }
开发者ID:webchemistry,项目名称:forms-controls,代码行数:12,代码来源:CheckboxList.php

示例4: getControl

 /**
  * 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));
 }
开发者ID:nette,项目名称:forms,代码行数:16,代码来源:RadioList.php

示例5: getControl

 /**
  * 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));
 }
开发者ID:jurasm2,项目名称:nette,代码行数:19,代码来源:RadioList.php


注:本文中的Nette\Forms\Helpers::createInputList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。