mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
4af6039107
commit
422ceaff85
2 changed files with 24 additions and 18 deletions
|
@ -1826,12 +1826,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Form->input('Contact.email', array('id' => 'custom'));
|
$result = $this->Form->input('Contact.email', array('id' => 'custom'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'div' => array('class' => 'input text'),
|
'div' => array('class' => 'input email'),
|
||||||
'label' => array('for' => 'custom'),
|
'label' => array('for' => 'custom'),
|
||||||
'Email',
|
'Email',
|
||||||
'/label',
|
'/label',
|
||||||
array('input' => array(
|
array('input' => array(
|
||||||
'type' => 'text', 'name' => 'data[Contact][email]',
|
'type' => 'email', 'name' => 'data[Contact][email]',
|
||||||
'id' => 'custom', 'maxlength' => 255
|
'id' => 'custom', 'maxlength' => 255
|
||||||
)),
|
)),
|
||||||
'/div'
|
'/div'
|
||||||
|
@ -1845,7 +1845,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'Email',
|
'Email',
|
||||||
'/label',
|
'/label',
|
||||||
array('input' => array(
|
array('input' => array(
|
||||||
'type' => 'text', 'name' => 'data[Contact][email]',
|
'type' => 'email', 'name' => 'data[Contact][email]',
|
||||||
'id' => 'ContactEmail', 'maxlength' => 255
|
'id' => 'ContactEmail', 'maxlength' => 255
|
||||||
)),
|
)),
|
||||||
'/div'
|
'/div'
|
||||||
|
@ -1920,12 +1920,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->Form->request->data = array('Contact' => array('phone' => 'Hello & World > weird chars'));
|
$this->Form->request->data = array('Contact' => array('phone' => 'Hello & World > weird chars'));
|
||||||
$result = $this->Form->input('Contact.phone');
|
$result = $this->Form->input('Contact.phone');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'div' => array('class' => 'input text'),
|
'div' => array('class' => 'input tel'),
|
||||||
'label' => array('for' => 'ContactPhone'),
|
'label' => array('for' => 'ContactPhone'),
|
||||||
'Phone',
|
'Phone',
|
||||||
'/label',
|
'/label',
|
||||||
array('input' => array(
|
array('input' => array(
|
||||||
'type' => 'text', 'name' => 'data[Contact][phone]',
|
'type' => 'tel', 'name' => 'data[Contact][phone]',
|
||||||
'value' => 'Hello & World > weird chars',
|
'value' => 'Hello & World > weird chars',
|
||||||
'id' => 'ContactPhone', 'maxlength' => 255
|
'id' => 'ContactPhone', 'maxlength' => 255
|
||||||
)),
|
)),
|
||||||
|
@ -2808,9 +2808,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
@ -2833,9 +2833,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
@ -2863,9 +2863,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
@ -2889,9 +2889,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
@ -2922,9 +2922,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
@ -2952,9 +2952,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
'input' => array('type' => 'hidden', 'name' => 'data[Contact][id]', 'id' => 'ContactId'),
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input text')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input email')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input text')),
|
array('div' => array('class' => 'input tel')),
|
||||||
'*/div',
|
'*/div',
|
||||||
array('div' => array('class' => 'input password')),
|
array('div' => array('class' => 'input password')),
|
||||||
'*/div',
|
'*/div',
|
||||||
|
|
|
@ -1129,6 +1129,10 @@ class FormHelper extends AppHelper {
|
||||||
$options['type'] = 'select';
|
$options['type'] = 'select';
|
||||||
} elseif (in_array($fieldKey, array('psword', 'passwd', 'password'))) {
|
} elseif (in_array($fieldKey, array('psword', 'passwd', 'password'))) {
|
||||||
$options['type'] = 'password';
|
$options['type'] = 'password';
|
||||||
|
} elseif (in_array($fieldKey, array('tel', 'telephone', 'phone'))) {
|
||||||
|
$options['type'] = 'tel';
|
||||||
|
} elseif ($fieldKey === 'email') {
|
||||||
|
$options['type'] = 'email';
|
||||||
} elseif (isset($options['checked'])) {
|
} elseif (isset($options['checked'])) {
|
||||||
$options['type'] = 'checkbox';
|
$options['type'] = 'checkbox';
|
||||||
} elseif ($fieldDef = $this->_introspectModel($modelKey, 'fields', $fieldKey)) {
|
} elseif ($fieldDef = $this->_introspectModel($modelKey, 'fields', $fieldKey)) {
|
||||||
|
@ -1235,7 +1239,9 @@ class FormHelper extends AppHelper {
|
||||||
is_scalar($fieldDef['length']) &&
|
is_scalar($fieldDef['length']) &&
|
||||||
$options['type'] !== 'select'
|
$options['type'] !== 'select'
|
||||||
);
|
);
|
||||||
if ($autoLength && $options['type'] == 'text') {
|
if ($autoLength &&
|
||||||
|
in_array($options['type'], array('text', 'email', 'tel', 'url'))
|
||||||
|
) {
|
||||||
$options['maxlength'] = $fieldDef['length'];
|
$options['maxlength'] = $fieldDef['length'];
|
||||||
}
|
}
|
||||||
if ($autoLength && $fieldDef['type'] == 'float') {
|
if ($autoLength && $fieldDef['type'] == 'float') {
|
||||||
|
|
Loading…
Reference in a new issue