Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28a91965be | ||
|
|
f1eddc7a78 | ||
|
|
745c10226d | ||
|
|
a0a763779d | ||
|
|
c55fda58b1 | ||
|
|
8ae4aa0627 | ||
|
|
e4b32919a3 | ||
|
|
e884f50d1c | ||
|
|
6b023d8055 |
No files matched your search
+5
-5
@@ -12,11 +12,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.4.0",
|
"php": ">=5.5.9",
|
||||||
"illuminate/http": "~5.0",
|
"illuminate/http": "5.1.*",
|
||||||
"illuminate/routing": "~5.0",
|
"illuminate/routing": "5.1.*",
|
||||||
"illuminate/session": "~5.0",
|
"illuminate/session": "5.1.*",
|
||||||
"illuminate/support": "~5.0"
|
"illuminate/support": "5.1.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "~0.9",
|
"mockery/mockery": "~0.9",
|
||||||
|
|||||||
+1
-8
@@ -935,14 +935,7 @@ class FormBuilder {
|
|||||||
*/
|
*/
|
||||||
protected function getModelValueAttribute($name)
|
protected function getModelValueAttribute($name)
|
||||||
{
|
{
|
||||||
if (is_object($this->model))
|
return data_get($this->model, $this->transformKey($name));
|
||||||
{
|
|
||||||
return object_get($this->model, $this->transformKey($name));
|
|
||||||
}
|
|
||||||
elseif (is_array($this->model))
|
|
||||||
{
|
|
||||||
return array_get($this->model, $this->transformKey($name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-3
@@ -358,9 +358,6 @@ class HtmlBuilder {
|
|||||||
{
|
{
|
||||||
$html = array();
|
$html = array();
|
||||||
|
|
||||||
// For numeric keys we will assume that the key and the value are the same
|
|
||||||
// as this will convert HTML attributes such as "required" to a correct
|
|
||||||
// form like required="required" instead of using incorrect numerics.
|
|
||||||
foreach ((array) $attributes as $key => $value)
|
foreach ((array) $attributes as $key => $value)
|
||||||
{
|
{
|
||||||
$element = $this->attributeElement($key, $value);
|
$element = $this->attributeElement($key, $value);
|
||||||
@@ -380,6 +377,9 @@ class HtmlBuilder {
|
|||||||
*/
|
*/
|
||||||
protected function attributeElement($key, $value)
|
protected function attributeElement($key, $value)
|
||||||
{
|
{
|
||||||
|
// For numeric keys we will assume that the key and the value are the same
|
||||||
|
// as this will convert HTML attributes such as "required" to a correct
|
||||||
|
// form like required="required" instead of using incorrect numerics.
|
||||||
if (is_numeric($key)) $key = $value;
|
if (is_numeric($key)) $key = $value;
|
||||||
|
|
||||||
if ( ! is_null($value)) return $key.'="'.e($value).'"';
|
if ( ! is_null($value)) return $key.'="'.e($value).'"';
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class HtmlServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function provides()
|
public function provides()
|
||||||
{
|
{
|
||||||
return array('html', 'form');
|
return array('html', 'form', 'Collective\Html\HtmlBuilder', 'Collective\Html\FormBuilder');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -137,6 +137,18 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testFormRepopulationWithMixOfArraysAndObjects()
|
||||||
|
{
|
||||||
|
$this->formBuilder->model(['user' => (object)['password' => 'apple']]);
|
||||||
|
$input = $this->formBuilder->text('user[password]');
|
||||||
|
$this->assertEquals('<input name="user[password]" type="text" value="apple">', $input);
|
||||||
|
|
||||||
|
$this->formBuilder->model((object)['letters' => ['a', 'b', 'c']]);
|
||||||
|
$input = $this->formBuilder->text('letters[1]');
|
||||||
|
$this->assertEquals('<input name="letters[1]" type="text" value="b">', $input);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testFormPassword()
|
public function testFormPassword()
|
||||||
{
|
{
|
||||||
$form1 = $this->formBuilder->password('foo');
|
$form1 = $this->formBuilder->password('foo');
|
||||||
|
|||||||
Reference in new issue
Block a user