mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
parent
a208eb6cb1
commit
e38c149880
1 changed files with 15 additions and 9 deletions
|
@ -2429,15 +2429,21 @@ class FormHelper extends AppHelper {
|
||||||
|
|
||||||
if ($attributes['style'] === 'checkbox') {
|
if ($attributes['style'] === 'checkbox') {
|
||||||
$htmlOptions['value'] = $name;
|
$htmlOptions['value'] = $name;
|
||||||
|
|
||||||
if (!empty($attributes['disabled'])) {
|
$disabledType = null;
|
||||||
if (is_array($attributes['disabled'])) {
|
$hasDisabled = !empty($attributes['disabled']);
|
||||||
if (in_array($htmlOptions['value'], $attributes['disabled'])) {
|
if ($hasDisabled) {
|
||||||
$htmlOptions['disabled'] = 'disabled';
|
$disabledType = gettype($attributes['disabled']);
|
||||||
}
|
}
|
||||||
} else {
|
if (
|
||||||
$htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
|
$hasDisabled &&
|
||||||
}
|
$disabledType === 'array' &&
|
||||||
|
in_array($htmlOptions['value'], $attributes['disabled'])
|
||||||
|
) {
|
||||||
|
$htmlOptions['disabled'] = 'disabled';
|
||||||
|
}
|
||||||
|
if ($hasDisabled && $disabledType !== 'array') {
|
||||||
|
$htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tagName = $attributes['id'] . Inflector::camelize(Inflector::slug($name));
|
$tagName = $attributes['id'] . Inflector::camelize(Inflector::slug($name));
|
||||||
|
|
Loading…
Reference in a new issue