本文整理汇总了PHP中Illuminate\Html\FormBuilder::checkbox方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder::checkbox方法的具体用法?PHP FormBuilder::checkbox怎么用?PHP FormBuilder::checkbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Html\FormBuilder
的用法示例。
在下文中一共展示了FormBuilder::checkbox方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkbox
/**
* Create a checkbox input field.
*
* @param string $name
* @param mixed $value
* @param bool $checked
* @param array $options
* @return string
*/
public function checkbox($name, $value = 1, $checked = null, $options = array())
{
$label = array_get($options, 'label', $this->translationDomain ? $this->translationDomain . '.' . $name : $name);
unset($options['label']);
$label = \Lang::get($label);
return '<div class="checkbox"><label>' . $this->form->checkbox($name, $value, $checked, $options) . $label . '</label></div>';
}
示例2: checkbox
/**
* Create a Bootstrap checkbox input.
*
* @param string $name
* @param string $label
* @param string $value
* @param boolean $checked
* @param boolean $inline
* @param boolean $wrapper
* @param array $options
* @return string
*/
public function checkbox($name, $label, $value, $checked = null, $inline = false, $options = array())
{
$labelOptions = $inline ? array('class' => 'checkbox-inline') : array();
$inputElement = $this->form->checkbox($name, $value, $checked, $options);
$labelElement = '<label ' . $this->html->attributes($labelOptions) . '>' . $inputElement . $label . '</label>';
return $inline ? $labelElement : '<div class="checkbox">' . $labelElement . '</div>';
}
示例3: prepareColumns
/**
* Prepare data grid columns.
*
* @param bool $results
* @return array
*/
protected function prepareColumns($model)
{
$el = [];
foreach ($this->dataGridColumns as $attributes) {
$type = array_pull($attributes, 'type');
if ($type) {
if ($type === 'a') {
$elementContent = '<%= r.' . array_pull($attributes, 'content') . ' %>';
$link = $this->html->decode($this->html->link('#', $elementContent, $attributes));
$link = str_replace('href="#"', 'href="<%= r.edit_uri %>"', $link);
$el[] = $link;
} elseif ($type === 'checkbox') {
$checkBoxName = array_pull($attributes, 'name');
$value = array_pull($attributes, 'value');
$value = '<%= r.' . $value . ' %>';
$el[] = $this->html->decode($this->form->checkbox($checkBoxName, $value, null, $attributes));
}
} else {
$el[] = '<%= r.' . array_pull($attributes, 'content') . ' %>';
}
}
return $el;
}
示例4: checkbox
/**
* Create a checkbox input field.
*
* @param string $name
* @param mixed $value
* @param bool $checked
* @param array $options
* @return string
* @static
*/
public static function checkbox($name, $value = 1, $checked = null, $options = array())
{
return \Illuminate\Html\FormBuilder::checkbox($name, $value, $checked, $options);
}
示例5: checkbox
/**
* Create a HTML checkbox input element.
*
* @param string $name
* @param string $label
* @param string $value
* @param bool $checked
* @param array $attributes
* @return string
*/
public function checkbox($name, $label = '', $value = '1', $checked = false, $attributes = array())
{
$checked = $this->calculateValue($name, $checked);
$attributes = $this->setAttributes($name, $attributes, false);
$field = parent::checkbox($name, $value, $checked, $attributes);
return $this->buildWrapper($field, $name, $label, true);
}
示例6: checkbox
/**
* Generate a checkbox input field
*
* @param string $name
* @param string $value
* @param array $options
*
* @return string
*/
public function checkbox($name, $value = null, $options = [])
{
$checked = $value === 1 || $value === "1" || $value === true ? true : null;
return $this->formBuilder->checkbox($name, 1, $checked, $options);
}
示例7: checkboxField
/**
* @param Field $field
* @return string
*/
public function checkboxField(Field $field)
{
return $this->builder->checkbox($field->name, $field->value, $field->checked, $field->getAttributes());
}
示例8: inlineCheckbox
/**
* Create an inline checkbox input field.
*
* @param string $name
* @param mixed $value
* @param mixed $label
* @param bool $checked
* @param array $options
*
* @return string
*/
public function inlineCheckbox($name, $value = 1, $label = null, $checked = null, $options = [])
{
$checkable = parent::checkbox($name, $value, $checked, $options);
return $this->wrapInlineCheckable($label, 'checkbox', $checkable);
}
示例9: checkbox
/**
* Create a checkbox input field.
*
* @param string $name
* @param mixed $value
* @param bool $checked
* @param array $options
* @return string
*/
public function checkbox($name, $value = 1, $checked = null, $options = array())
{
$this->appendReadOnly($options);
return parent::checkbox($name, $value, $checked, $options);
}