• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Html\FormBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了FormBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: setSessionStore

 /**
  * Set the session store implementation.
  *
  * @param \Illuminate\Session\Store $session
  * @return \Illuminate\Html\FormBuilder 
  * @static 
  */
 public static function setSessionStore($session)
 {
     return \Illuminate\Html\FormBuilder::setSessionStore($session);
 }
开发者ID:jorzhikgit,项目名称:MLM-Nexus,代码行数:11,代码来源:_ide_helper.php


示例5: function

 * Create a select box field.
 *
 * @param  string  $name
 * @param  array   $list
 * @param  string  $selected
 * @param  array   $options
 * @return string
 */
FormBuilder::macro('selectMy', function ($name, $list = array(), $selected = null, $option = '', $options = array()) {
    // When building a select box the "value" attribute is really the selected one
    // so we will use that when checking the model or session for a value which
    // should provide a convenient method of re-populating the forms on post.
    $selected = $this->getValueAttribute($name, $selected);
    $options['id'] = $this->getIdAttribute($name, $options);
    if (!isset($options['name'])) {
        $options['name'] = $name;
    }
    // We will simply loop through the options and build an HTML value for each of
    // them until we have an array of HTML declarations. Then we will join them
    // all together into one single HTML element that can be put on the form.
    $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);
    return "<select{$options}>{$option}{$list}</select>";
});
开发者ID:Vatia13,项目名称:gbtimes,代码行数:31,代码来源:macros.php


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


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


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


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


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


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


示例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(), $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


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


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


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


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


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


示例18: 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;
 }
开发者ID:sohailaammarocs,项目名称:lfc,代码行数:29,代码来源:DataGridGenerator.php


示例19: 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;
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:35,代码来源:BootstrapBase.php


示例20: color

 /**
  * Creates a color element
  *
  * @param string $name The name of the element
  * @param null   $value
  * @param array  $attributes
  * @return string
  */
 public function color($name, $value = null, $attributes = array())
 {
     $attributes['class'] = isset($attributes['class']) ? self::FORM_CONTROL . ' ' . $attributes['class'] : self::FORM_CONTROL;
     return parent::input('color', $name, $value, $attributes);
 }
开发者ID:olax,项目名称:epetitions,代码行数:13,代码来源:Form.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Html\HtmlBuilder类代码示例发布时间:2022-05-23
下一篇:
PHP Hashing\BcryptHasher类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap