本文整理汇总了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);
}
示例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
)
);
}
示例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);
}
示例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));
}
示例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));
}