mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +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') {
|
||||
$htmlOptions['value'] = $name;
|
||||
|
||||
if (!empty($attributes['disabled'])) {
|
||||
if (is_array($attributes['disabled'])) {
|
||||
if (in_array($htmlOptions['value'], $attributes['disabled'])) {
|
||||
$htmlOptions['disabled'] = 'disabled';
|
||||
}
|
||||
} else {
|
||||
$htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
|
||||
}
|
||||
|
||||
$disabledType = null;
|
||||
$hasDisabled = !empty($attributes['disabled']);
|
||||
if ($hasDisabled) {
|
||||
$disabledType = gettype($attributes['disabled']);
|
||||
}
|
||||
if (
|
||||
$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));
|
||||
|
|
Loading…
Reference in a new issue