mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
parent
e54e494b4b
commit
94e83fa81c
2 changed files with 3 additions and 4 deletions
|
@ -5974,7 +5974,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
public function testPostButton() {
|
public function testPostButton() {
|
||||||
$result = $this->Form->postButton('Hi', '/controller/action');
|
$result = $this->Form->postButton('Hi', '/controller/action');
|
||||||
$this->assertTags($result, array(
|
$this->assertTags($result, array(
|
||||||
'form' => array('method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8', 'style' => 'display:none;'),
|
'form' => array('method' => 'post', 'action' => '/controller/action', 'accept-charset' => 'utf-8'),
|
||||||
'div' => array('style' => 'display:none;'),
|
'div' => array('style' => 'display:none;'),
|
||||||
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
|
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
|
||||||
'/div',
|
'/div',
|
||||||
|
@ -6000,7 +6000,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'form' => array(
|
'form' => array(
|
||||||
'method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8',
|
'method' => 'post', 'action' => '/posts/delete/1', 'accept-charset' => 'utf-8',
|
||||||
'style' => 'display:none;'
|
|
||||||
),
|
),
|
||||||
array('div' => array('style' => 'display:none;')),
|
array('div' => array('style' => 'display:none;')),
|
||||||
array('input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST')),
|
array('input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST')),
|
||||||
|
|
|
@ -1545,7 +1545,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Create a `<button>` tag with a surrounding `<form>` that submits via POST.
|
* Create a `<button>` tag with a surrounding `<form>` that submits via POST.
|
||||||
*
|
*
|
||||||
* This method creates a `<form>` element. So do not use this method in some opened form.
|
* This method creates a `<form>` element. So do not use this method in an already opened form.
|
||||||
* Instead use FormHelper::submit() or FormHelper::button() to create buttons inside opened forms.
|
* Instead use FormHelper::submit() or FormHelper::button() to create buttons inside opened forms.
|
||||||
*
|
*
|
||||||
* ### Options:
|
* ### Options:
|
||||||
|
@ -1560,7 +1560,7 @@ class FormHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postButton
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postButton
|
||||||
*/
|
*/
|
||||||
public function postButton($title, $url, $options = array()) {
|
public function postButton($title, $url, $options = array()) {
|
||||||
$out = $this->create(false, array('id' => false, 'url' => $url, 'style' => 'display:none;'));
|
$out = $this->create(false, array('id' => false, 'url' => $url));
|
||||||
if (isset($options['data']) && is_array($options['data'])) {
|
if (isset($options['data']) && is_array($options['data'])) {
|
||||||
foreach ($options['data'] as $key => $value) {
|
foreach ($options['data'] as $key => $value) {
|
||||||
$out .= $this->hidden($key, array('value' => $value, 'id' => false));
|
$out .= $this->hidden($key, array('value' => $value, 'id' => false));
|
||||||
|
|
Loading…
Reference in a new issue