mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing PHP error with $divOptions in FormHelper::input() when passing $option['div'] = false
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7066 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
03322a31d7
commit
d294e91d42
2 changed files with 5 additions and 5 deletions
|
@ -615,6 +615,7 @@ class FormHelper extends AppHelper {
|
|||
|
||||
$out = '';
|
||||
$div = true;
|
||||
$divOptions = array();
|
||||
|
||||
if (array_key_exists('div', $options)) {
|
||||
$div = $options['div'];
|
||||
|
@ -622,7 +623,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if (!empty($div)) {
|
||||
$divOptions = array('class' => 'input');
|
||||
$divOptions['class'] = 'input';
|
||||
$divOptions = $this->addClass($divOptions, $options['type']);
|
||||
if (is_string($div)) {
|
||||
$divOptions['class'] = $div;
|
||||
|
@ -768,7 +769,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isset($divOptions)) {
|
||||
if ($divOptions && isset($divOptions['tag'])) {
|
||||
$tag = $divOptions['tag'];
|
||||
unset($divOptions['tag']);
|
||||
$out = $this->Html->tag($tag, $out, $divOptions);
|
||||
|
|
|
@ -835,18 +835,17 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Model.field', array('div' => array('tag' => 'span'), 'error' => array('wrap' => 'span')));
|
||||
$result = $this->Form->input('Model.field', array('div' => false, 'error' => array('wrap' => 'span')));
|
||||
$expected = array(
|
||||
'span' => array('class' => 'input text error'),
|
||||
'label' => array('for' => 'ModelField'),
|
||||
'Field',
|
||||
'/label',
|
||||
'input' => array('type' => 'text', 'name' => 'data[Model][field]', 'value' => '', 'id' => 'ModelField', 'class' => 'form-error'),
|
||||
array('span' => array('class' => 'error-message')),
|
||||
'Badness!',
|
||||
'/span',
|
||||
'/span'
|
||||
);
|
||||
// debug($result);exit;
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Model.field', array('div' => array('tag' => 'span'), 'error' => array('wrap' => false)));
|
||||
|
|
Loading…
Reference in a new issue