mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Rewrote class attribute assignment
This commit is contained in:
parent
615be3ad14
commit
dcd7563707
1 changed files with 11 additions and 15 deletions
|
@ -932,11 +932,14 @@ class FormHelper extends AppHelper {
|
|||
|
||||
if (isset($options['legend'])) {
|
||||
$legend = $options['legend'];
|
||||
unset($options['legend']);
|
||||
}
|
||||
if (isset($options['fieldset'])) {
|
||||
$fieldset = $options['fieldset'];
|
||||
$fieldsetAttrs = ['class' => $options['fieldset']];
|
||||
unset($options['fieldset']);
|
||||
}
|
||||
|
||||
|
||||
if (empty($fields)) {
|
||||
$fields = $modelFields;
|
||||
}
|
||||
|
@ -971,17 +974,13 @@ class FormHelper extends AppHelper {
|
|||
$out .= $this->input($name, $options);
|
||||
}
|
||||
|
||||
if (is_string($fieldset)) {
|
||||
$fieldsetClass = sprintf(' class="%s"', $fieldset);
|
||||
} else {
|
||||
$fieldsetClass = '';
|
||||
}
|
||||
|
||||
|
||||
if ($fieldset) {
|
||||
if ($legend) {
|
||||
$out = $this->Html->useTag('legend', $legend) . $out;
|
||||
}
|
||||
$out = $this->Html->useTag('fieldset', $fieldsetClass, $out);
|
||||
$out = $this->Html->useTag('fieldset', $fieldsetAttrs, $out);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
@ -1545,9 +1544,9 @@ class FormHelper extends AppHelper {
|
|||
$legend = __(Inflector::humanize($this->field()));
|
||||
}
|
||||
|
||||
$fieldset = '';
|
||||
$fieldsetAttrs = '';
|
||||
if (isset($attributes['fieldset'])) {
|
||||
$fieldset = $attributes['fieldset'];
|
||||
$fieldsetAttrs = ['class' => $attributes['fieldset']];
|
||||
unset($attributes['fieldset']);
|
||||
}
|
||||
|
||||
|
@ -1644,13 +1643,10 @@ class FormHelper extends AppHelper {
|
|||
if (is_array($between)) {
|
||||
$between = '';
|
||||
}
|
||||
|
||||
if ($legend) {
|
||||
if (is_string($fieldset)) {
|
||||
$fieldsetClass = sprintf(' class="%s"', $fieldset);
|
||||
} else {
|
||||
$fieldsetClass = '';
|
||||
}
|
||||
$out = $this->Html->useTag('fieldset', $fieldsetClass, $this->Html->useTag('legend', $legend) . $between . $out);
|
||||
$out = $this->Html->useTag('legend', $legend) . $between . $out;
|
||||
$out = $this->Html->useTag('fieldset', $fieldsetAttrs, $out);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue