本文整理汇总了PHP中Collective\Html\FormBuilder::open方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder::open方法的具体用法?PHP FormBuilder::open怎么用?PHP FormBuilder::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collective\Html\FormBuilder
的用法示例。
在下文中一共展示了FormBuilder::open方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: open
/**
* Return the opening form tag.
*
* @param array $options
* @return string
*/
public function open(array $options = [])
{
if ($url = $this->object->getOption('url')) {
$options['url'] = $url;
}
return $this->html->open($options);
}
示例2: open
/**
* Open a form while passing a model and the routes for storing or updating
* the model. This will set the correct route along with the correct
* method.
*
* @param array $options
*
* @return string
*/
public function open(array $options = [])
{
// Set the HTML5 role.
$options['role'] = 'form';
// Set the class for the form type.
if (!array_key_exists('class', $options)) {
$options['class'] = $this->getType();
}
if (array_key_exists('left_column_class', $options)) {
$this->setLeftColumnClass($options['left_column_class']);
}
if (array_key_exists('left_column_offset_class', $options)) {
$this->setLeftColumnOffsetClass($options['left_column_offset_class']);
}
if (array_key_exists('right_column_class', $options)) {
$this->setRightColumnClass($options['right_column_class']);
}
if (array_key_exists('label_required_mark', $options)) {
$this->setLabelRequiredMark($options['label_required_mark']);
}
if (array_key_exists('group_required_class', $options)) {
$this->setLabelRequiredMark($options['group_required_class']);
}
array_forget($options, ['left_column_class', 'left_column_offset_class', 'right_column_class', 'label_required_mark', 'group_required_class']);
if (array_key_exists('model', $options)) {
return $this->model($options);
}
return $this->form->open($options);
}
示例3: open
/**
* Open up a new HTML form.
* Sets "form-horizontal" as the default class for forms.
*
* @param array $options
* @return string
*/
public function open(array $options = array())
{
if (!isset($options['class'])) {
$options['class'] = 'form-horizontal';
}
return parent::open($options);
}
示例4: 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);
}
示例5: open
/**
* Open a form while passing a model and the routes for storing or updating
* the model. This will set the correct route along with the correct
* method.
*
* @param array $options
* @return string
*/
public function open(array $options = [])
{
// Set the HTML5 role.
$options['role'] = 'form';
// Set the class for the form type.
if (!array_key_exists('class', $options)) {
$options['class'] = $this->getType();
}
if (array_key_exists('left_column_class', $options)) {
$this->setLeftColumnClass($options['left_column_class']);
}
if (array_key_exists('left_column_offset_class', $options)) {
$this->setLeftColumnOffsetClass($options['left_column_offset_class']);
}
if (array_key_exists('right_column_class', $options)) {
$this->setRightColumnClass($options['right_column_class']);
}
// Set the name of the error bag to pull from the session. The default is "default".
// This allows multiple forms to be on the same page without error messages colliding
if (array_key_exists('errorBag', $options)) {
$this->errorBag = $options['errorBag'];
}
array_forget($options, ['left_column_class', 'left_column_offset_class', 'right_column_class', 'errorBag']);
if (array_key_exists('model', $options)) {
return $this->model($options);
}
return $this->form->open($options);
}
示例6: open
public function open(array $options = [])
{
if (array_key_exists('model', $options)) {
PkForm::setModel($options['model']);
unset($options['model']);
}
return parent::open($options);
}
示例7: 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);
}
示例8: open
/**
* Opens form with a set of validation rules
* @param array $rules Laravel validation rules
* @see Collective\Html\FormBuilder
* @return string
*/
public function open(array $options = [], $rules = null)
{
$this->setValidation($rules);
if (isset($options['name'])) {
$this->converter->setFormName($options['name']);
} else {
$this->converter->setFormName(null);
}
return parent::open($options);
}
示例9: open
/**
* Open a form while passing a model and the routes for storing or updating
* the model. This will set the correct route along with the correct
* method.
*
* @param array $options
* @return string
*/
public function open(array $options = [])
{
// Set the HTML5 role.
$options['role'] = 'form';
// Set the class for the form type.
if (!isset($options['class'])) {
$options['class'] = $this->getType();
}
if (isset($options['left_column_class'])) {
$this->setLeftColumnClass($options['left_column_class']);
}
if (isset($options['left_column_offset_class'])) {
$this->setLeftColumnOffsetClass($options['left_column_offset_class']);
}
if (isset($options['right_column_class'])) {
$this->setRightColumnClass($options['right_column_class']);
}
array_forget($options, ['left_column_class', 'left_column_offset_class', 'right_column_class']);
if (isset($options['model'])) {
return $this->model($options);
}
return $this->form->open($options);
}
示例10: open
/**
* Open up a new HTML form.
*
* @param array $options
* @return string
* @static
*/
public static function open($options = array())
{
return \Collective\Html\FormBuilder::open($options);
}
示例11: open
public function open(array $options = [])
{
$this->initializeForm($options);
return parent::open($options);
}
示例12: function
Form::macro('delete', function ($route, $id, $text = '', $tooltip = false, $icon = true) {
$model = explode('.', $route);
$model = ucfirst(substr($model[1], 0, -1));
$tooltip = $tooltip ? $tooltip : 'Deletar ' . $model;
$out = Form::open(['route' => [$route . '.destroy', $id], 'method' => 'DELETE', 'data-id' => $id, 'style' => 'display: inline-block']);
$out .= '<button data-toggle="tooltip" data-placement="top" data-original-title="' . $tooltip . '" type="submit" data-id="' . $id . '" class="btn btn-danger btn-sm ' . ($icon ? 'btn-fw' : '') . '">';
$out .= $icon ? '<i class="fa fa-times"></i> ' . $text : $text;
$out .= '</button>';
$out .= Form::close();
return $out;
});
Form::macro('undelete', function ($route, $id, $text = '', $tooltip = false) {
$model = explode('.', $route);
$model = ucfirst(substr($model[1], 0, -1));
$tooltip = $tooltip ? $tooltip : 'Reativar ' . $model;
$out = Form::open(['route' => [$route . '.undestroy', $id], 'method' => 'PUT', 'data-confirm' => $id . '-ativar', 'style' => 'display: inline-block']);
$out .= '<button data-toggle="tooltip" data-placement="top"
data-original-title="' . $tooltip . '" type="submit" data-confirm="' . $id . '-ativar" class="btn btn-warning btn-fw btn-sm">';
$out .= '<i class="fa fa-undo"></i> ' . $text;
$out .= '</button>';
$out .= Form::close();
return $out;
});
Form::macro('edit', function ($route, $id, $text = '', $tooltip = false) {
$model = explode('.', $route);
$model = ucfirst(substr($model[1], 0, -1));
$tooltip = $tooltip ? $tooltip : 'Editar ' . $model;
$out = '<a data-toggle="tooltip" data-placement="top" data-original-title="' . $tooltip . '" href="' . route($route . '.edit', $id) . '" class="btn btn-fw btn-success btn-sm">';
$out .= '<i class="fa fa-pencil"></i> ' . $text;
$out .= '</a>';
return $out;