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


PHP Html\FormBuilder类代码示例

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


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

示例1: registerFormBuilder

 /**
  * Register the form builder instance.
  *
  * @return void
  */
 protected function registerFormBuilder()
 {
     $this->app->bindShared('form', function ($app) {
         $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     });
 }
开发者ID:kartx22,项目名称:Otoru-Dice,代码行数:12,代码来源:HtmlServiceProvider.php

示例2: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('form', function ($app) {
         $form = new FormBuilder($app['html'], $app['url'], $app['session.store']->getToken());
         return $form->setSessionStore($app['session.store']);
     });
     $this->app->singleton('html', function ($app) {
         return new HtmlBuilder($app['url']);
     });
 }
开发者ID:ferranfg,项目名称:laravextra,代码行数:15,代码来源:LaravextraServiceProvider.php

示例3: hasMacro

 /**
  * Checks if macro is registered
  *
  * @param string $name
  * @return boolean 
  * @static 
  */
 public static function hasMacro($name)
 {
     return \Illuminate\Html\FormBuilder::hasMacro($name);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:11,代码来源:_ide_helper.php

示例4: registerFormIfHeeded

 /**
  * Add Laravel Form to container if not already set
  */
 private function registerFormIfHeeded()
 {
     if (!$this->app->offsetExists('form')) {
         $this->app->bindShared('form', function ($app) {
             $form = new LaravelForm($app['html'], $app['url'], $app['session.store']->getToken());
             return $form->setSessionStore($app['session.store']);
         });
         if (!$this->aliasExists('Form')) {
             AliasLoader::getInstance()->alias('Form', 'Illuminate\\Html\\FormFacade');
         }
     }
 }
开发者ID:adhikjoshi,项目名称:D-provider,代码行数:15,代码来源:FormBuilderServiceProvider.php

示例5: button

 public function button($value = null, $options = array())
 {
     if (strpos(@$options['class'], 'btn') === false) {
         @($options['class'] .= ' btn btn-default');
     }
     return parent::password($value, $options);
 }
开发者ID:rtconner,项目名称:laravel-plusplus,代码行数:7,代码来源:BootstrapFormBuilder.php

示例6: render

 /**
  * Render the form for a given action or the default form.
  *
  * @param  string $action
  * @param  array  $attributes
  *
  * @return string
  */
 public function render($action = null, array $attributes = array())
 {
     $renderer = $this->getRenderer();
     $html = $this->open($action, $attributes);
     $html .= $renderer->render($this->getFields());
     $html .= $this->builder->close();
     return $html;
 }
开发者ID:ruysu,项目名称:laravel4-form,代码行数:16,代码来源:FormBuilder.php

示例7: 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

示例8: close

    public function close()
    {
        return sprintf('<div class="form-group">
				<button type="submit"
					class="btn btn-success btn-block btn-loading"
					data-loading="<span class=\'glyphicon glyphicon-refresh spinning\'></span>">حفظ
				</button>
			</div>%s', parent::close());
    }
开发者ID:OmarMakled,项目名称:Html,代码行数:9,代码来源:FormBuilder.php

示例9: input

 /**
  * Create the input group for an element with the correct classes for errors.
  *
  * @param  string  $type
  * @param  string  $name
  * @param  string  $label
  * @param  string  $value
  * @param  array   $options
  * @return string
  */
 public function input($type, $name, $label = null, $value = null, $options = array())
 {
     $label = $this->getLabelTitle($label, $name);
     $options = $this->getFieldOptions($options);
     $wrapperOptions = array('class' => $this->getRightColumnClass());
     $inputElement = $type == 'password' ? $this->form->password($name, $options) : $this->form->{$type}($name, $value, $options);
     $groupElement = '<div ' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . '</div>';
     return $this->getFormGroup($name, $label, $groupElement);
 }
开发者ID:Javier-Rotelli,项目名称:bootstrap-form,代码行数:19,代码来源:BootstrapForm.php

示例10: 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);
 }
开发者ID:shyam-achuthan,项目名称:laravel5bootstrap3form,代码行数:20,代码来源:FormBuilder.php

示例11: buttonField

 /**
  * @param Field $field
  * @param string $type
  * @return string
  */
 public function buttonField(Field $field, $type = 'button')
 {
     $attributes = $field->getAttributes();
     $attributes['type'] = $type;
     if ($field->label) {
         $value = $field->label;
         $attributes['value'] = $field->value;
     } else {
         $value = $field->value;
     }
     return $this->builder->button($value, $attributes);
 }
开发者ID:iyoworks,项目名称:form-builder,代码行数:17,代码来源:LaravelFormRenderer.php

示例12: 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);
 }
开发者ID:kamaroly,项目名称:shift,代码行数:22,代码来源:FieldBuilder.php

示例13: open

 /**
  * Open up a new HTML form and includes a session key.
  * @param array $options
  * @return string
  */
 public function open(array $options = [])
 {
     $method = strtoupper(array_get($options, 'method', 'post'));
     $request = array_get($options, 'request');
     $model = array_get($options, 'model');
     if ($model) {
         $this->model = $model;
     }
     $append = $this->requestHandler($request);
     if ($method != 'GET') {
         $append .= $this->sessionKey(array_get($options, 'sessionKey'));
     }
     return parent::open($options) . $append;
 }
开发者ID:janusnic,项目名称:23copperleaf,代码行数:19,代码来源:FormBuilder.php

示例14: 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;
 }
开发者ID:illuminate3,项目名称:bootawesome,代码行数:28,代码来源:BootstrapBase.php

示例15: testElements

 public function testElements()
 {
     $this->getApplicationMock()->expects($this->exactly(1))->method('make')->with('form')->will($this->returnValue($this->formBuilderMock));
     $this->testInstance->setMeta($this->metaAttributesMock);
     $this->metaAttributesMock->__value = uniqid();
     $this->metaAttributesMock->setLocale('_');
     $testMethods = ['open', 'select', 'close', 'submit', 'hidden', 'checkbox', 'radio', 'text', 'password', 'textarea'];
     foreach ($testMethods as $testMethod) {
         $this->formBuilderMock->expects($this->exactly(1))->method($testMethod);
     }
     $this->assertSame("<label>label</label>", (string) $this->testInstance->label('label'));
     $this->testInstance->open();
     $this->testInstance->close();
     $this->testInstance->select('value');
     $this->testInstance->submit('value');
     $this->testInstance->hidden('value');
     $this->testInstance->checkbox('value');
     $this->testInstance->radio('value');
     $this->testInstance->text('value');
     $this->testInstance->textarea('value');
     $this->testInstance->password('value');
 }
开发者ID:laravel-commode,项目名称:bladed,代码行数:22,代码来源:FormTest.php


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