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


PHP FormBuilder::label方法代码示例

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


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

示例1: label

 /**
  * Create a form label element.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return string
  */
 public function label($name, $value = null, $options = array())
 {
     if ($this->validationErrors && $this->validationErrors->has($name)) {
         $options = $this->addClass($options, $this->errorCssClass);
     }
     return parent::label($name, $value, $options);
 }
开发者ID:wingsline,项目名称:inuitcss,代码行数:15,代码来源:FormBuilder.php

示例2: label

 /**
  * Create a form label field.
  *
  * @param string $name
  * @param string $label
  * @param array  $options
  *
  * @return string
  */
 protected function label($name, $label = null, array $options = array())
 {
     $options = array_merge(array('class' => 'control-label ' . $this->labelClass), $options);
     if ($label) {
         return $this->form->label($name, $label, $options) . "\n";
     }
     return '';
 }
开发者ID:illuminate3,项目名称:bootawesome,代码行数:17,代码来源:BootstrapBase.php

示例3: getLabelFor

 /**
  * Get the label for a field
  *
  * @param  InputInterface $field
  * @param  string         $id
  * @param  array          $attributes
  *
  * @return string|boolean
  */
 public function getLabelFor(InputInterface $field, $id, array $attributes = array())
 {
     $label = $field->getLabel();
     if ($label) {
         return $this->builder->label($id, $label, $attributes);
     }
     return false;
 }
开发者ID:ruysu,项目名称:laravel4-form,代码行数:17,代码来源:FieldCollection.php

示例4: label

 /**
  * Create a form label element.
  *
  * @param string $name
  * @param string $value
  * @param array $options
  * @return string 
  * @static 
  */
 public static function label($name, $value = null, $options = array())
 {
     return \Illuminate\Html\FormBuilder::label($name, $value, $options);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:13,代码来源:_ide_helper.php

示例5: buildLabel

 /**
  * Builds the label html
  *
  * @param  string  $name The name of the html field
  * @param  string  $label The label name
  * @param  array   $attributes
  * @return string
  */
 private function buildLabel($name, $label = '', $attributes = array())
 {
     $out = '';
     if (!empty($label)) {
         if (!empty($attributes['class'])) {
             $attributes['class'] .= ' control-label';
         } else {
             $attributes['class'] = 'control-label';
         }
         if ($this->getOption('requiredLabel') and substr($label, -strlen($this->getOption('requiredLabel'))) == $this->getOption('requiredLabel')) {
             $label = $this->getOption('requiredPrefix') . str_replace($this->getOption('requiredLabel'), '', $label) . $this->getOption('requiredSuffix');
             $attributes['class'] .= ' ' . $this->getOption('requiredClass');
         }
         $name = $this->getOption('idPrefix') . $name;
         $out .= parent::label($name, $label, $attributes);
     }
     return $out;
 }
开发者ID:jarnstedt,项目名称:former,代码行数:26,代码来源:Former.php

示例6: label

 /**
  * Create a label.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  *
  * @return string
  */
 public function label($name, $value = null, $options = [])
 {
     $this->addErrorClass($name, $options);
     return parent::label($name, $value, $options);
 }
开发者ID:stolz,项目名称:laravel-form-builder,代码行数:14,代码来源:Foundation.php

示例7: label

 /**
  * {@inheritdoc}
  * @param string      $name    The name of the object this label will be
  *                             attached to
  * @param string|null $value   The text of the label
  * @param array       $options The options of the label
  * @return string
  */
 public function label($name, $value = null, $options = array())
 {
     $options['class'] = isset($options['class']) ? self::LABEL . ' ' . $options['class'] : self::LABEL;
     return parent::label($name, $value, $options);
 }
开发者ID:olax,项目名称:epetitions,代码行数:13,代码来源:Form.php

示例8: label

 /**
  * Create a Bootstrap label.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return string
  */
 public function label($name, $value = null, $options = array())
 {
     $options = $this->getLabelOptions($options);
     return $this->form->label($name, $value, $options);
 }
开发者ID:Javier-Rotelli,项目名称:bootstrap-form,代码行数:13,代码来源:BootstrapForm.php

示例9: labelField

 /**
  * @param Field $field
  * @return string
  */
 public function labelField(Field $field)
 {
     return $this->builder->label($field->name, $field->value, $field->getAttributes());
 }
开发者ID:iyoworks,项目名称:form-builder,代码行数:8,代码来源:LaravelFormRenderer.php

示例10: label

 /**
  * Create a Bootstrap label.
  *
  * @param  string $name
  * @param  string $value
  * @param  array $options
  * @return string
  */
 public function label($name, $value = null, $options = [])
 {
     $options = $this->getLabelOptions($options);
     return $this->form->label($name, \Lang::get($value), $options);
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:13,代码来源:BootstrapFormBuilder.php

示例11: label

 /**
  * Create a form label element.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return \Illuminate\Support\HtmlString
  */
 public function label($name, $value = null, $options = [])
 {
     return new HtmlString(parent::label($name, $value, $options));
 }
开发者ID:minors,项目名称:html,代码行数:12,代码来源:FormBuilder.php

示例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())
 {
     $selected = $this->getValueAttribute($name, $selected);
     $options['id'] = $this->getIdAttribute($name, $options);
     if (!isset($options['name'])) {
         $options['name'] = $name;
     }
     // The form-control class should be a default class for every input
     // generated. The class option on the input also overrides every
     // default classes set.
     if (isset($options['class'])) {
         $this->setClass($options['class']);
     }
     $options['class'] = "form-control " . $this->class;
     // Removes keys for the wrapper from the $options array and puts them
     // into variables to prevent them from appearing as attributes on the
     // input itself.
     array_key_exists('label', $options) ? $label = array_pull($options, 'label') : ($label = null);
     $html = array();
     foreach ($list as $value => $display) {
         $html[] = $this->getSelectOption($display, $value, $selected);
     }
     // Once we have all of this HTML, we can join this into a single element after
     // formatting the attributes into an HTML "attributes" string, then we will
     // build out a final select statement, which will contain all the values.
     $options = $this->html->attributes($options);
     $list = implode('', $html);
     // Sets the $input variable to the newly generated input field, this
     // variable will then be used within the Bootstrap wrapper instead of
     // being returned directly.
     $input = "<select{$options}>{$list}</select>";
     // If there are errors we want to add the has-error class to the form-group
     // tag to make the border glow red.
     if (!is_null($this->errors) && $this->errors->has($name) && $name != NULL) {
         $this->formGroupClass .= " has-error";
         // If exteded feedback is also enabled we will also add the has-feedback
         // class to allow showing the icons.
         if ($this->feedback === true) {
             $this->formGroupClass .= " has-feedback";
         }
     }
     // The return variable holds the HTML output that is returned to the user.
     // It's purposely divided into lines to allow for better reading and
     // easier conditionals for some of the output.
     $return = '<div class="form-group ' . $this->formGroupClass . '">';
     $return .= '<div class="row">';
     $return .= '<div class="col-md-4">';
     // If a label is given then we show the label here. Notice
     // that the form class is available as IlluminateFormBuilder
     // and not as Form.
     if (!is_null($label)) {
         $return .= IlluminateFormBuilder::label($name, $label);
     }
     $return .= '</div>';
     $return .= '<div class="col-md-8 text-right">';
     // If errors are present we show the error message here.
     // Error styling can be done using the validation-error
     // class that is added automatically.
     if (!is_null($this->errors) && $this->errors->has($name) && $name != NULL) {
         $return .= $this->errors->first($name, '<p class="text-danger validation-error">:message</p>');
     }
     $return .= '</div>';
     $return .= '</div>';
     $return .= $input;
     $return .= '</div>';
     $this->resetConfig();
     return $return;
 }
开发者ID:YammYcoding,项目名称:BootstrapForm,代码行数:77,代码来源:BootstrapForm.php


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