本文整理汇总了PHP中Collective\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->singleton('form', function ($app) {
$form = new FormBuilder($app['html'], $app['url'], $app['view'], $app['session.store']->getToken());
return $form->setSessionStore($app['session.store']);
});
}
开发者ID:abordin,项目名称:html,代码行数:12,代码来源:HtmlServiceProvider.php
示例2: registerFormBuilder
/**
* Register the form builder instance.
*
* @return void
*/
protected function registerFormBuilder()
{
$this->app->singleton('form', function ($app) {
/** @var Store $session */
$session = $app['session.store'];
$form = new FormBuilder($app['html'], $app['url'], $session->token());
$form->setSessionStore($session);
return $form;
});
$this->app->alias('form', 'Collective\\Html\\FormBuilder');
}
开发者ID:vluzrmos,项目名称:collective-html,代码行数:16,代码来源:HtmlServiceProvider.php
示例3: register
/**
* Register any application services.
*
* This service provider is a great spot to register your various container
* bindings with the application. As you can see, we are registering our
* "Registrar" implementation here. You can add your own bindings too!
*
* @return void
*/
public function register()
{
parent::register();
FormBuilder::macro('template', function ($template, $empty = false, $field = 'template') {
$template_list = '';
if ($empty) {
$template_list[''] = '-';
}
$folder = base_path() . '/resources/views/site/';
if (is_dir($folder)) {
$iterator = new \DirectoryIterator($folder);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile() && !$fileinfo->isDot()) {
$file = explode('.', $fileinfo->getFilename());
array_pop($file);
$value = implode('.', $file);
$template_list[$value] = $value;
}
}
}
if ($template_list) {
return Form::select($field, $template_list, $template, ['class' => "form-control"]);
}
return '';
});
}
开发者ID:Ognestraz,项目名称:lumen-admin,代码行数:35,代码来源:MacroServiceProvider.php
示例4: registerFormSubmit
private function registerFormSubmit()
{
FormBuilder::macro('button_submit', function ($texte) {
return FormBuilder::submit($texte, ['class' => 'btn btn-info pull-right']);
});
}
开发者ID:WizzerOmega,项目名称:webstock,代码行数:6,代码来源:HtmlFormServiceProvider.php
示例5: hasMacro
/**
* Checks if macro is registered.
*
* @param string $name
* @return bool
* @static
*/
public static function hasMacro($name)
{
return \Collective\Html\FormBuilder::hasMacro($name);
}
开发者ID:alvarobfdev,项目名称:BaseCRUDproject,代码行数:11,代码来源:_ide_helper.php
示例6: setSessionStore
/**
* Set the session store implementation.
*
* @param \Illuminate\Session\Store $session
* @return $this
* @static
*/
public static function setSessionStore($session)
{
return \Collective\Html\FormBuilder::setSessionStore($session);
}
开发者ID:puresolcom,项目名称:ether,代码行数:11,代码来源:_ide_helper.php
示例7: close
/**
* Closes form and reset $this->rules
*
* @see Collective\Html\FormBuilder
*/
public function close()
{
$this->resetValidation();
return parent::close();
}
开发者ID:laravel-ardent,项目名称:laravalid,代码行数:10,代码来源:FormBuilder.php
示例8: componentCall
/**
* Dynamically handle calls to the class.
*
* @param string $method
* @param array $parameters
* @return \Illuminate\Contracts\View\View|mixed
* @throws \BadMethodCallException
* @static
*/
public static function componentCall($method, $parameters)
{
return \Collective\Html\FormBuilder::componentCall($method, $parameters);
}
开发者ID:blargent,项目名称:pimplot,代码行数:13,代码来源:_ide_helper.php
示例9: register
/**
* Register the application services.
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/config/config.php', 'laform');
$this->app->bind('laform', 'Karan\\Laform\\Laform');
if (!$this->app->offsetExists('form')) {
$this->app->singleton('form', function ($app) {
// LaravelCollective\HtmlBuilder 5.2 is not backward compatible and will throw an exeption
// https://github.com/kristijanhusak/laravel-form-builder/commit/a36c4b9fbc2047e81a79ac8950d734e37cd7bfb0
if (substr(Application::VERSION, 0, 3) == '5.2') {
$form = new LaravelForm($app['html'], $app['url'], $app['view'], $app['session.store']->getToken());
} else {
$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', 'Collective\\Html\\FormFacade');
}
}
if (!$this->app->offsetExists('html')) {
$this->app->singleton('html', function ($app) {
return new HtmlBuilder($app['url'], $app['view']);
});
if (!$this->aliasExists('Html')) {
AliasLoader::getInstance()->alias('Html', 'Collective\\Html\\HtmlFacade');
}
}
}
开发者ID:karanjilka,项目名称:laform,代码行数:31,代码来源:LaformServiceProvider.php
示例10: registerFormIfHeeded
/**
* Add Laravel Form to container if not already set
*/
private function registerFormIfHeeded()
{
if (!$this->app->offsetExists('form')) {
$this->app->singleton('form', function ($app) {
$form = new LaravelForm($app['html'], $app['url'], $app['view'], $app['session.store']->getToken());
return $form->setSessionStore($app['session.store']);
});
if (!$this->aliasExists('Form')) {
AliasLoader::getInstance()->alias('Form', 'Collective\\Html\\FormFacade');
}
}
}
开发者ID:seydu,项目名称:laravel-form-builder,代码行数:15,代码来源:FormBuilderServiceProvider.php
示例11: open
/**
* Open up a new HTML form and pass the optional novalidate option.
* This methods relies on the original Form::open method of the Laravel
* Collective component.
*
* @param array $options
*
* @return string
*/
public function open(array $options = array())
{
if ($this->novalidate()) {
$options[] = 'novalidate';
}
return parent::open($options);
}
开发者ID:mcarral,项目名称:html,代码行数:16,代码来源:FormBuilder.php
示例12: open
/**
* @param array $options
*
* @return string
*/
public function open(array $options = [])
{
$themeName = array_get($options, 'theme', config('rutorika-form.theme'));
$themeClass = config('rutorika-form.themes.' . $themeName);
$this->theme = new $themeClass($this);
$options = $this->theme->updateOptions($options);
return parent::open($options);
}
开发者ID:grozwalker,项目名称:rutorika-laravel-html,代码行数:13,代码来源:FormBuilder.php
示例13: commonInputs
private function commonInputs($type, $name, $value = null, $options = [])
{
return sprintf('
<div class="input-field col l6 s8 offset-l3 offset-s2">
%s
%s
</div>', parent::input($type, $name, $value, $options), parent::label($name, null, []));
}
开发者ID:codificar,项目名称:scaffolder-theme-material,代码行数:8,代码来源:MaterialThemeForm.php
示例14: getErrors
/**
* Get the MessageBag of errors that is populated by the
* validator.
*
* @return \Illuminate\Support\ViewErrorBag
*/
protected function getErrors()
{
$errors = $this->form->getSessionStore()->get('errors');
if ($errors) {
return $errors->getBag($this->errorBag);
}
return $errors;
}
开发者ID:mstralka,项目名称:bootstrap-form,代码行数:14,代码来源:BootstrapForm.php
示例15: selection
public function selection($nom, $list = [], $selected = null, $label = null)
{
return sprintf('
<div class="form-group" style="width:200px;">
%s
%s
</div>', $label ? $this->label($nom, $label, ['class' => 'control-label']) : '', parent::select($nom, $list, $selected, ['class' => 'form-control']));
}
开发者ID:thaida,项目名称:CMS,代码行数:8,代码来源:FormBuilder.php
示例16: open
public function open(array $options = [])
{
if (array_key_exists('model', $options)) {
PkForm::setModel($options['model']);
unset($options['model']);
}
return parent::open($options);
}
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:8,代码来源:PkFormBuilder.php
示例17: textarea
public function textarea($name, $value = null, $options = [])
{
return sprintf('
<div class="input-field col l6 s8 offset-l3 offset-s2">
%s
%s
</div>', parent::textarea($name, $value, ['class' => 'materialize-textarea']), parent::label($name, null, []));
}
开发者ID:gitter-badger,项目名称:scaffolder-theme-material,代码行数:8,代码来源:MaterialThemeForm.php
示例18: close
public function close()
{
$results = '';
if (Generator::END == $this->gen->getCodePosition()) {
$results .= $this->generateClientValidatorCode();
}
$results .= parent::close();
return $results;
}
开发者ID:bignerdranch,项目名称:client-validation-generator,代码行数:9,代码来源:FormBuilder.php
示例19: 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
示例20: checkbox
public function checkbox($name, $value = 1, $checked = null, $options = [])
{
return parent::hidden($name, 0) . call_user_func_array('parent::' . __FUNCTION__, func_get_args());
}
开发者ID:IQ-RIA,项目名称:scaffolder-theme-material,代码行数:4,代码来源:MaterialThemeForm.php
注:本文中的Collective\Html\FormBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论