本文整理汇总了PHP中Illuminate\Html\FormBuilder::select方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder::select方法的具体用法?PHP FormBuilder::select怎么用?PHP FormBuilder::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Html\FormBuilder
的用法示例。
在下文中一共展示了FormBuilder::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
public function select($name, $list = array(), $selected = null, $options = array())
{
if (strpos(@$options['class'], 'form-control') === false) {
@($options['class'] .= ' form-control');
}
return parent::select($name, $list, $selected, $options);
}
示例2: select
/**
* Create a select box field.
*
* @param string $name
* @param array $list
* @param string $selected
* @param array $options
* @return string
*/
public function select($name, $list = array(), $selected = null, $options = array(), $label = '')
{
if (!self::$is_bootstrap) {
return parent::select($name, $list, $selected, $options);
}
$label_text = $label == '' ? $this->transformKey($name) : $label;
$options = $this->appendClassToOptions('form-control', $options);
// Call the parent select method so that Laravel can handle
// the rest of the select set up.
return $this->openGroup($name, $label_text) . parent::select($name, $list, $selected, $options) . $this->closeGroup($name);
}
示例3: select
public function select($name, $list = [], $selected = null, $options = [])
{
$label = array_get($options, 'label', $this->translationDomain ? $this->translationDomain . '.' . $name : $name);
unset($options['label']);
$label = \Lang::get($label);
$options = $this->getFieldOptions($options);
$wrapperOptions = ['class' => $this->getRightColumnClass()];
$inputElement = $this->form->select($name, $list, $selected, $options);
$groupElement = '<div ' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . '</div>';
return $this->getFormGroup($name, $label, $groupElement);
}
示例4: select
/**
* Generate a select field.
*
* @param $name
* @param string $value
* @param array $options
*
* @return string
*/
public function select($name, $value = null, $options = [])
{
$select_options = [];
// Loop through, and pluck out the select box list options
// from the $options array, then remove the select options.
foreach ($options as $key => $label) {
if (is_array($label)) {
$select_options = $label;
unset($options[$key]);
}
}
return $this->formBuilder->select($name, $select_options, $value, $options);
}
示例5: options
/**
* Create a form select field.
*
* @param string $name
* @param string $label
* @param array $list
* @param string $selected
* @param \Illuminate\Support\MessageBag $errors
* @param array $options
*
* @return string
*/
protected function options($name, $label = null, array $list = array(), $selected = null, $errors = null, array $options = array())
{
$options = array_merge(array('class' => 'form-control'), $options);
$return = $this->group($name, $errors);
$return .= $this->label($name, $label);
if ($this->formType == self::FORM_HORIZONTAL) {
$return .= $this->group('', null, $this->inputClass);
}
$return .= $this->form->select($name, $list, $selected, $options) . "\n";
$return .= $this->errors($name, $errors);
if ($this->formType == self::FORM_HORIZONTAL) {
$return .= '</div>' . "\n";
}
$return .= '</div>' . "\n";
return $return;
}
示例6: options
/**
* Create a form select field.
*
* @param string $name
* @param string $label
* @param array $list
* @param string $selected
* @param \Illuminate\Support\MessageBag $errors
* @param array $options
*
* @return string
*/
protected function options($name, $label = null, array $list = array(), $selected = null, $errors = null, array $options = array())
{
$return = '';
$options = array_merge(array('class' => 'form-control', 'id' => $name), $options);
$containerAttributes = $this->getContainerAttributes($options);
$labelAttributes = $this->getLabelAttributes($options);
if (!isset($containerAttributes['display'])) {
$return .= $this->group($name, $errors, 'form-group', $containerAttributes);
}
$return .= $this->label($name, $label, $labelAttributes);
if ($this->formType == self::FORM_HORIZONTAL) {
$return .= $this->group('', null, $this->inputClass);
}
$return .= $this->form->select($name, $list, $selected, $options) . "\n";
$return .= $this->errors($name, $errors);
if ($this->formType == self::FORM_HORIZONTAL) {
$return .= '</div>' . "\n";
}
if (!isset($containerAttributes['display'])) {
$return .= '</div>' . "\n";
}
return $return;
}
示例7: selectField
/**
* @param Field $field
* @return string
*/
public function selectField(Field $field)
{
return $this->builder->select($field->name, $field->options ?: [], $field->value, $field->getAttributes());
}
示例8: select
/**
* Create a select box field with empty option support.
* @param string $name
* @param array $list
* @param string $selected
* @param array $options
* @return string
*/
public function select($name, $list = [], $selected = null, $options = [])
{
if (array_key_exists('emptyOption', $options)) {
$list = ['' => $options['emptyOption']] + $list;
}
return parent::select($name, $list, $selected, $options);
}
示例9: select
/**
* Create a select box field.
*
* @param string $name
* @param array $list
* @param string $selected
* @param array $options
*
* @return string
*/
public function select($name, $list = array(), $selected = null, $options = [])
{
$this->addErrorClass($name, $options);
$tags['input'] = parent::select($name, $list, $selected, $options);
$tags['error'] = $this->getErrorTag($name);
return $this->buildTags($tags);
}
示例10: select
public function select($name, $list = [], $selected = null, $options = [])
{
$options = array_merge($options, $this->parsley->getFieldRules($name));
return parent::select($name, $list, $selected, $options);
}
示例11: select
/**
* {@inheritdoc}
* @param string $name
* @param array $list
* @param null $selected
* @param array $attributes
* @return string
*/
public function select($name, $list = array(), $selected = null, $attributes = array())
{
$attributes['class'] = isset($attributes['class']) ? self::FORM_CONTROL . ' ' . $attributes['class'] : self::FORM_CONTROL;
return parent::select($name, $list, $selected, $attributes);
}
示例12: select
/**
* Create a select box field.
*
* @param string $name
* @param array $list
* @param string $selected
* @param array $options
* @return string
*/
public function select($name, $list = array(), $selected = null, $options = array())
{
$options = $this->addErrorClass($name, $options);
$options = $this->checkRequired($name, $options);
return parent::select($name, $list, $selected, $options);
}
示例13: select
/**
* @see Illuminate\Html\FormBuilder
*/
public function select($name, $list = [], $selected = null, $options = [])
{
$options = $this->laravelToJquery($name) + $options;
return parent::select($name, $list, $selected, $options);
}
示例14: select
/**
* @see Illuminate\Html\FormBuilder
*/
public function select($name, $list = [], $selected = null, $options = [])
{
$options = $this->converter->convert(Helper::getFormAttribute($name)) + $options;
return parent::select($name, $list, $selected, $options);
}
示例15: select
/**
* Create a HTML select element.
*
* @param string $name
* @param string $label
* @param array $options
* @param string $selected
* @param array $attributes
* @return string
*/
public function select($name, $label = '', $options = null, $selected = null, $attributes = array())
{
$modelOptions = null;
if (is_null($options)) {
$modelOptions = $this->getModelOptions($name);
}
if (!is_null($modelOptions)) {
$options = $modelOptions;
}
$selected = $this->calculateValue($name, $selected);
$attributes = $this->setAttributes($name, $attributes);
$field = parent::select($name, $options, $selected, $attributes);
return $this->buildWrapper($field, $name, $label);
}