mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
7206254166
commit
58de6702bc
2 changed files with 19 additions and 2 deletions
|
@ -2153,6 +2153,23 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that inputs with 0 can be created.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testInputZero() {
|
||||||
|
$this->Form->create('User');
|
||||||
|
$result = $this->Form->input('0');
|
||||||
|
$expected = array(
|
||||||
|
'div' => array('class' => 'input text'),
|
||||||
|
'label' => array('for' => 'User0'), '/label',
|
||||||
|
'input' => array('type' => 'text', 'name' => 'data[User][0]', 'id' => 'User0'),
|
||||||
|
'/div'
|
||||||
|
);
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test input() with checkbox creation
|
* test input() with checkbox creation
|
||||||
*
|
*
|
||||||
|
|
|
@ -199,7 +199,7 @@ class FormHelper extends AppHelper {
|
||||||
$this->fieldset[$object->alias]['fields'][$alias] = array('type' => 'multiple');
|
$this->fieldset[$object->alias]['fields'][$alias] = array('type' => 'multiple');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($field)) {
|
if ($field === null || $field === false) {
|
||||||
return $this->fieldset[$model]['fields'];
|
return $this->fieldset[$model]['fields'];
|
||||||
} elseif (isset($this->fieldset[$model]['fields'][$field])) {
|
} elseif (isset($this->fieldset[$model]['fields'][$field])) {
|
||||||
return $this->fieldset[$model]['fields'][$field];
|
return $this->fieldset[$model]['fields'][$field];
|
||||||
|
@ -773,7 +773,7 @@ class FormHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::label
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::label
|
||||||
*/
|
*/
|
||||||
public function label($fieldName = null, $text = null, $options = array()) {
|
public function label($fieldName = null, $text = null, $options = array()) {
|
||||||
if (empty($fieldName)) {
|
if ($fieldName === null) {
|
||||||
$fieldName = implode('.', $this->entity());
|
$fieldName = implode('.', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue