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


PHP FormBuilder::radio方法代码示例

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


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

示例1: radio

 /**
  * Create a Bootstrap radio input.
  *
  * @param  string   $name
  * @param  string   $label
  * @param  string   $value
  * @param  bool     $checked
  * @param  bool     $inline
  * @param  array    $options
  * @return string
  */
 public function radio($name, $label, $value, $checked = null, $inline = false, array $options = [])
 {
     $labelOptions = $inline ? ['class' => 'radio-inline'] : [];
     $inputElement = $this->form->radio($name, $value, $checked, $options);
     $labelElement = '<label ' . $this->html->attributes($labelOptions) . '>' . $inputElement . $label . '</label>';
     return $inline ? $labelElement : '<div class="radio">' . $labelElement . '</div>';
 }
开发者ID:jeylabs,项目名称:larastrap,代码行数:18,代码来源:BootstrapForm.php

示例2: radio

 public function radio($name, $value = null, $checked = null, $options = [])
 {
     return sprintf('
     <div class="input-field col l6 s8 offset-l3 offset-s2">
         %s
         %s
     </div>', parent::radio($name, $value, $checked, $options), parent::label($options['id'], $value, []));
 }
开发者ID:codificar,项目名称:scaffolder-theme-material,代码行数:8,代码来源:MaterialThemeForm.php

示例3: buildControl

 /**
  * Build all control with the css class, label, and input.
  *
  * @param       $type
  * @param       $name
  * @param null  $value
  * @param array $attributes
  * @param array $options
  * @return string
  */
 public function buildControl($type, $name, $value = null, $attributes = [], $options = [])
 {
     switch ($type) {
         case 'select':
             $options = ['' => config('field-builder.select')] + $options;
             return $this->form->select($name, $options, $value, $attributes);
         case 'password':
             return $this->form->password($name, $attributes);
         case 'checkbox':
             return $this->form->checkbox($name, $value, isset($attributes['checked']), $attributes);
         case 'textarea':
             return $this->form->textarea($name, $value, $attributes);
         case 'number':
             return $this->form->number($name, $value, $attributes);
         case 'radio':
             return $this->form->radio($name, $value, $attributes);
         case 'email':
             return $this->form->email($name, $value, $attributes);
         default:
             return $this->form->input($type, $name, $value, $attributes);
     }
 }
开发者ID:socieboy,项目名称:forms,代码行数:32,代码来源:FieldBuilder.php

示例4: radio

 /**
  * Create a radio button input field.
  *
  * @param string $name
  * @param mixed $value
  * @param bool $checked
  * @param array $options
  * @return string 
  * @static 
  */
 public static function radio($name, $value = null, $checked = null, $options = array())
 {
     return \Collective\Html\FormBuilder::radio($name, $value, $checked, $options);
 }
开发者ID:alvarobfdev,项目名称:BaseCRUDproject,代码行数:14,代码来源:_ide_helper.php

示例5: inlineRadio

 /**
  * Create an inline radio button input field.
  *
  * @param  string $name
  * @param  mixed  $value
  * @param  mixed  $label
  * @param  bool   $checked
  * @param  array  $options
  *
  * @return string
  */
 public function inlineRadio($name, $value = null, $label = null, $checked = null, $options = [])
 {
     //Capture label
     $label = $this->getLabel($name, $options, false);
     //Capture Bootstrap classes
     $class = $this->getClasses($name, $options);
     $class = $this->appendClassToOptions('radio-inline', $class);
     $object = parent::radio($name, $value, $checked, $options);
     return $this->wrapCheckable($label, $class, $object);
 }
开发者ID:drickferreira,项目名称:enhanced-bootstrap-forms,代码行数:21,代码来源:FormBuilder.php

示例6: wrappedRadio

 /**
  * @param $name
  * @param $labelText
  * @param null $value
  * @param null $checked
  * @param array $options
  * @return string
  */
 public function wrappedRadio($name, $labelText, $value = null, $checked = null, $options = [])
 {
     return $this->wrapWithLabel($name, $labelText, $options, parent::radio($name, $value, $checked, $this->appendErrors($name, $options)));
 }
开发者ID:timothyvictor,项目名称:laravel5-foundation,代码行数:12,代码来源:FoundationFiveFormBuilder.php

示例7: radio

 public function radio($name, $value = 1, $checked = null, $options = [])
 {
     $additionalClasses = $this->usesBootstrap4() ? 'form-check-input' : '';
     $options = $this->setOptionClasses($name, $options, [$additionalClasses]);
     $label = $options['label'];
     $controlOptions = $this->getControlOptions(collect($options), ['form-control', 'placeholder']);
     $controlHtml = parent::radio($name, $value, $checked, $controlOptions->toArray()) . " {$label}";
     return $this->renderControl('radio', $controlHtml, $name, $value, $options);
 }
开发者ID:genealabs,项目名称:laravel-casts,代码行数:9,代码来源:FormBuilder.php

示例8: inlineRadio

 /**
  * Create an inline radio button input field.
  *
  * @param  string $name
  * @param  mixed $value
  * @param  mixed $label
  * @param  bool $checked
  * @param  array $options
  *
  * @return string
  */
 public function inlineRadio($name, $value = null, $label = null, $checked = null, $options = [])
 {
     $checkable = parent::radio($name, $value, $checked, $options);
     return $this->wrapInlineCheckable($label, 'radio', $checkable);
 }
开发者ID:summmmit,项目名称:web,代码行数:16,代码来源:BootstrapFormBuilder.php

示例9: inlineRadio

 /**
  * Create an inline radio button
  *
  * @param  string  $name
  * @param  mixed   $value
  * @param  mixed   $label
  * @param  bool    $checked
  * @param  array   $options
  * @return string
  */
 public function inlineRadio($name, $value = null, $label = null, $checked = null, $options = array())
 {
     return $this->wrapInlineCheckable($label, 'radio', parent::radio($name, $value, $checked, $options));
 }
开发者ID:core-system,项目名称:bootstrap-form,代码行数:14,代码来源:BootstrapFormBuilder.php

示例10: foreach

    $out .= '<div class="radio">';
    foreach ($values as $value) {
        $out .= '<label class="radio-inline">';
        $out .= Form::radio($name, $value, $checked ? $checked == $value : old($name) == $value, $attributes) . $options[$value];
        $out .= '</label>';
    }
    $out .= '</div>';
    return form_group($out, $name);
});
Form::macro('radioStack', function ($name, $label = NULL, array $options, $checked = NULL, $attributes = []) {
    $out = $label ? '<label for="' . $name . '">' . $label . '</label>' : '';
    $values = array_keys($options);
    foreach ($values as $value) {
        $out .= '<div class="radio">';
        $out .= '<label>';
        $out .= Form::radio($name, $value, $checked ? $checked == $value : old($name) == $value, $attributes) . $options[$value];
        $out .= '</label>';
        $out .= '</div>';
    }
    return form_group($out, $name);
});
Form::macro('checkboxField', function ($name, $label = NULL, $value = 1, $checked = NULL, $attributes = []) {
    $out = '<div class="checkbox';
    $out .= field_error($name) . '">';
    $out .= '<label>';
    $out .= Form::checkbox($name, $value, $checked ? $checked : old($name), $attributes) . $label;
    $out .= '</div>';
    return $out;
});
Form::macro('delete', function ($route, $id, $text = '', $tooltip = false, $icon = true) {
    $model = explode('.', $route);
开发者ID:brunoti,项目名称:html-macros,代码行数:31,代码来源:macros.php


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