work on form builder. tweak blade escaping behavior.

This commit is contained in:
Taylor Otwell committed 2013-02-26 23:26:14 -06:00
1 parent 92879ca385
commit 28832d5d71
1 file changed
+12 -9
+12 -9
View File
@@ -46,7 +46,7 @@ class FormBuilder {
* *
* @var array * @var array
*/ */
protected $reserved = array('method', 'url', 'route', 'action'); protected $reserved = array('method', 'url', 'route', 'action', 'files');
/** /**
* Create a new form builder instance. * Create a new form builder instance.
@@ -85,30 +85,33 @@ class FormBuilder {
// different method than it actually is, for convenience from the forms. // different method than it actually is, for convenience from the forms.
$append = $this->getAppendage($method); $append = $this->getAppendage($method);
$attributes = array_merge( if (isset($options['files']) and $options['files'])
$attributes, array_except($options, $this->reserved) {
); $options['enctype'] = 'multipart/form-data';
}
// Finally we're ready to create the final form HTML field. We will attribute // Finally we're ready to create the final form HTML field. We will attribute
// format the array of attributes. We will also add on the appendage which // format the array of attributes. We will also add on the appendage which
// is used to spoof the requests for PUT and DELETE requests to the app. // is used to spoof the requests for PUT and DELETE requests to the app.
$attributes = Html::attributes($attributes); $attributes = array_merge(
$attributes, array_except($options, $this->reserved)
);
return '<form'.$attributes.'>'.$append; return '<form'.Html::attributes($attributes).'>'.$append;
} }
/** /**
* Create a new model based form builder. * Create a new model based form builder.
* *
* @param mixed $model * @param mixed $model
* @param array $attributes * @param array $options
* @return string * @return string
*/ */
public function model($model, array $attributes) public function model($model, array $options)
{ {
$this->model = $model; $this->model = $model;
return $this->open($attributes); return $this->open($options);
} }
/** /**