Refactor the form class comments.
This commit is contained in:
parent
f6aecf706a
commit
23e86c707d
|
@ -22,8 +22,8 @@ public static function open($action = null, $method = 'POST', $attributes = arra
|
||||||
{
|
{
|
||||||
$attributes['action'] = HTML::entities(URL::to(((is_null($action)) ? Request::uri() : $action), $https));
|
$attributes['action'] = HTML::entities(URL::to(((is_null($action)) ? Request::uri() : $action), $https));
|
||||||
|
|
||||||
// If the request method is PUT or DELETE, we'll default the request method to POST
|
// PUT and DELETE methods are spoofed using a hidden field containing the request method.
|
||||||
// since the request method is being spoofed by the form.
|
// Since, HTML does not support PUT and DELETE on forms, we will use POST.
|
||||||
$attributes['method'] = ($method == 'PUT' or $method == 'DELETE') ? 'POST' : $method;
|
$attributes['method'] = ($method == 'PUT' or $method == 'DELETE') ? 'POST' : $method;
|
||||||
|
|
||||||
if ( ! array_key_exists('accept-charset', $attributes))
|
if ( ! array_key_exists('accept-charset', $attributes))
|
||||||
|
@ -33,8 +33,6 @@ public static function open($action = null, $method = 'POST', $attributes = arra
|
||||||
|
|
||||||
$html = '<form'.HTML::attributes($attributes).'>';
|
$html = '<form'.HTML::attributes($attributes).'>';
|
||||||
|
|
||||||
// If the request method is PUT or DELETE, create a hidden input element with the
|
|
||||||
// request method in it since HTML forms do not support these two methods.
|
|
||||||
if ($method == 'PUT' or $method == 'DELETE')
|
if ($method == 'PUT' or $method == 'DELETE')
|
||||||
{
|
{
|
||||||
$html .= PHP_EOL.static::input('hidden', 'REQUEST_METHOD', $method);
|
$html .= PHP_EOL.static::input('hidden', 'REQUEST_METHOD', $method);
|
||||||
|
|
Loading…
Reference in New Issue