Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0918dac79f | ||
|
|
28a91965be | ||
|
|
f1eddc7a78 | ||
|
|
745c10226d | ||
|
|
a0a763779d | ||
|
|
c55fda58b1 | ||
|
|
8ae4aa0627 | ||
|
|
e4b32919a3 | ||
|
|
e884f50d1c | ||
|
|
6b023d8055 |
No files matched your search
@@ -1,7 +1,6 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
|
||||
+5
-5
@@ -12,11 +12,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"illuminate/http": "~5.0",
|
||||
"illuminate/routing": "~5.0",
|
||||
"illuminate/session": "~5.0",
|
||||
"illuminate/support": "~5.0"
|
||||
"php": ">=5.5.9",
|
||||
"illuminate/http": "5.1.*",
|
||||
"illuminate/routing": "5.1.*",
|
||||
"illuminate/session": "5.1.*",
|
||||
"illuminate/support": "5.1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9",
|
||||
|
||||
+1
-8
@@ -935,14 +935,7 @@ class FormBuilder {
|
||||
*/
|
||||
protected function getModelValueAttribute($name)
|
||||
{
|
||||
if (is_object($this->model))
|
||||
{
|
||||
return object_get($this->model, $this->transformKey($name));
|
||||
}
|
||||
elseif (is_array($this->model))
|
||||
{
|
||||
return array_get($this->model, $this->transformKey($name));
|
||||
}
|
||||
return data_get($this->model, $this->transformKey($name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -358,9 +358,6 @@ class HtmlBuilder {
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$element = $this->attributeElement($key, $value);
|
||||
@@ -380,6 +377,9 @@ class HtmlBuilder {
|
||||
*/
|
||||
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_null($value)) return $key.'="'.e($value).'"';
|
||||
|
||||
@@ -61,7 +61,7 @@ class HtmlServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
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()
|
||||
{
|
||||
$form1 = $this->formBuilder->password('foo');
|
||||
|
||||
Reference in new issue
Block a user