mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
refs #6635 FormHelper::radio() return collect id attributes with multibyte
This commit is contained in:
parent
15f88533e8
commit
8ebc9cdd87
2 changed files with 25 additions and 1 deletions
|
@ -3902,6 +3902,25 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/fieldset'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->radio(
|
||||
'Model.multibyte',
|
||||
array('男性' => '男性')
|
||||
);
|
||||
$expected = array(
|
||||
'input' => array(
|
||||
'type' => 'hidden', 'name' => 'data[Model][multibyte]',
|
||||
'id' => 'ModelMultibyte_', 'value' => '',
|
||||
),
|
||||
array('input' => array(
|
||||
'type' => 'radio', 'name' => 'data[Model][multibyte]',
|
||||
'id' => 'ModelMultibyte男性', 'value' => '男性')
|
||||
),
|
||||
array('label' => array('for' => 'ModelMultibyte男性')),
|
||||
'男性',
|
||||
'/label',
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -495,7 +495,12 @@ class Inflector {
|
|||
*/
|
||||
public static function humanize($lowerCaseAndUnderscoredWord) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
|
||||
$result = ucwords(str_replace('_', ' ', $lowerCaseAndUnderscoredWord));
|
||||
$result = str_replace('_', ' ', $lowerCaseAndUnderscoredWord);
|
||||
if (function_exists('mb_convert_case') && Multibyte::checkMultibyte($result)) {
|
||||
$result = mb_convert_case($result, MB_CASE_TITLE, Configure::read('App.encoding'));
|
||||
} else {
|
||||
$result = ucwords($result);
|
||||
}
|
||||
self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
|
||||
}
|
||||
return $result;
|
||||
|
|
Loading…
Add table
Reference in a new issue