Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ef9a3c9ae | ||
|
|
d2910a7a97 | ||
|
|
895115187e | ||
|
|
240cfcfd31 | ||
|
|
f622d996df | ||
|
|
d4c632dc5c | ||
|
|
8d18ac6a68 | ||
|
|
ae9f533f99 | ||
|
|
6906174183 | ||
|
|
c44b222756 | ||
|
|
eed5d939e8 | ||
|
|
9d45eb1cc1 |
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|

|
||||||
|
|
||||||
|
[](https://travis-ci.org/LaravelCollective/html)
|
||||||
|
[](https://packagist.org/packages/laravelcollective/html)
|
||||||
|
[](https://packagist.org/packages/laravelcollective/html)
|
||||||
|
[](https://packagist.org/packages/laravelcollective/html)
|
||||||
|
[](https://packagist.org/packages/laravelcollective/html)
|
||||||
|
|
||||||
|
A documentação oficial para Forms & Html para o framework Laravel podem ser encontrados no site [LaravelCollective](https://laravelcollective.com/docs).
|
||||||
+8
-2
@@ -1201,7 +1201,13 @@ class FormBuilder
|
|||||||
protected function getRouteAction($options)
|
protected function getRouteAction($options)
|
||||||
{
|
{
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
return $this->url->route($options[0], array_slice($options, 1));
|
$parameters = array_slice($options, 1);
|
||||||
|
|
||||||
|
if (array_keys($options) === [0, 1]) {
|
||||||
|
$parameters = head($parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->url->route($options[0], $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->url->route($options);
|
return $this->url->route($options);
|
||||||
@@ -1360,7 +1366,7 @@ class FormBuilder
|
|||||||
return $this->model->getFormValue($key);
|
return $this->model->getFormValue($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data_get($this->model, $this->transformKey($name));
|
return data_get($this->model, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+17
-10
@@ -171,12 +171,13 @@ class HtmlBuilder
|
|||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
|
* @param bool $escape
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\HtmlString
|
* @return \Illuminate\Support\HtmlString
|
||||||
*/
|
*/
|
||||||
public function secureLink($url, $title = null, $attributes = [])
|
public function secureLink($url, $title = null, $attributes = [], $escape = true)
|
||||||
{
|
{
|
||||||
return $this->link($url, $title, $attributes, true);
|
return $this->link($url, $title, $attributes, true, $escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,14 +187,15 @@ class HtmlBuilder
|
|||||||
* @param string $title
|
* @param string $title
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @param bool $secure
|
* @param bool $secure
|
||||||
|
* @param bool $escape
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\HtmlString
|
* @return \Illuminate\Support\HtmlString
|
||||||
*/
|
*/
|
||||||
public function linkAsset($url, $title = null, $attributes = [], $secure = null)
|
public function linkAsset($url, $title = null, $attributes = [], $secure = null, $escape = true)
|
||||||
{
|
{
|
||||||
$url = $this->url->asset($url, $secure);
|
$url = $this->url->asset($url, $secure);
|
||||||
|
|
||||||
return $this->link($url, $title ?: $url, $attributes, $secure);
|
return $this->link($url, $title ?: $url, $attributes, $secure, $escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -202,12 +204,13 @@ class HtmlBuilder
|
|||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
|
* @param bool $escape
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\HtmlString
|
* @return \Illuminate\Support\HtmlString
|
||||||
*/
|
*/
|
||||||
public function linkSecureAsset($url, $title = null, $attributes = [])
|
public function linkSecureAsset($url, $title = null, $attributes = [], $escape = true)
|
||||||
{
|
{
|
||||||
return $this->linkAsset($url, $title, $attributes, true);
|
return $this->linkAsset($url, $title, $attributes, true, $escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,12 +220,14 @@ class HtmlBuilder
|
|||||||
* @param string $title
|
* @param string $title
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
|
* @param bool $secure
|
||||||
|
* @param bool $escape
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\HtmlString
|
* @return \Illuminate\Support\HtmlString
|
||||||
*/
|
*/
|
||||||
public function linkRoute($name, $title = null, $parameters = [], $attributes = [])
|
public function linkRoute($name, $title = null, $parameters = [], $attributes = [], $secure = null, $escape = true)
|
||||||
{
|
{
|
||||||
return $this->link($this->url->route($name, $parameters), $title, $attributes);
|
return $this->link($this->url->route($name, $parameters), $title, $attributes, $secure, $escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,12 +237,14 @@ class HtmlBuilder
|
|||||||
* @param string $title
|
* @param string $title
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
|
* @param bool $secure
|
||||||
|
* @param bool $escape
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Support\HtmlString
|
* @return \Illuminate\Support\HtmlString
|
||||||
*/
|
*/
|
||||||
public function linkAction($action, $title = null, $parameters = [], $attributes = [])
|
public function linkAction($action, $title = null, $parameters = [], $attributes = [], $secure = null, $escape = true)
|
||||||
{
|
{
|
||||||
return $this->link($this->url->action($action, $parameters), $title, $attributes);
|
return $this->link($this->url->action($action, $parameters), $title, $attributes, $secure, $escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use Collective\Html\FormBuilder;
|
|||||||
use Collective\Html\HtmlBuilder;
|
use Collective\Html\HtmlBuilder;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Route;
|
||||||
use Illuminate\Routing\RouteCollection;
|
use Illuminate\Routing\RouteCollection;
|
||||||
use Illuminate\Routing\UrlGenerator;
|
use Illuminate\Routing\UrlGenerator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -99,6 +100,24 @@ class FormBuilderTest extends PHPUnit\Framework\TestCase
|
|||||||
$form5);
|
$form5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFormRoute()
|
||||||
|
{
|
||||||
|
$routes = new RouteCollection();
|
||||||
|
$routes->get('user/{id}');
|
||||||
|
$routes->add(new Route(['GET'], 'user/{id}', ['as' => 'user.show']));
|
||||||
|
$this->urlGenerator->setRoutes($routes);
|
||||||
|
|
||||||
|
$form1 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', 1, 'foo' => 'bar']]);
|
||||||
|
$form2 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', 'id' => 2, 'foo' => 'bar']]);
|
||||||
|
$form3 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', [3, 'foo' => 'bar']]]);
|
||||||
|
$form4 = $this->formBuilder->open(['method' => 'GET', 'route' => ['user.show', ['id' => 4, 'foo' => 'bar']]]);
|
||||||
|
|
||||||
|
$this->assertEquals('<form method="GET" action="http://localhost/user/1?foo=bar" accept-charset="UTF-8">', $form1);
|
||||||
|
$this->assertEquals('<form method="GET" action="http://localhost/user/2?foo=bar" accept-charset="UTF-8">', $form2);
|
||||||
|
$this->assertEquals('<form method="GET" action="http://localhost/user/3?foo=bar" accept-charset="UTF-8">', $form3);
|
||||||
|
$this->assertEquals('<form method="GET" action="http://localhost/user/4?foo=bar" accept-charset="UTF-8">', $form4);
|
||||||
|
}
|
||||||
|
|
||||||
public function testClosingForm()
|
public function testClosingForm()
|
||||||
{
|
{
|
||||||
$this->assertEquals('</form>', $this->formBuilder->close());
|
$this->assertEquals('</form>', $this->formBuilder->close());
|
||||||
|
|||||||
Reference in new issue
Block a user