Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- New #249: Add `Tag::addStyle()` and `Tag::removeStyle()` methods (@vjik)
- New #252: Add `Color` class, `Html::color()` and `Input::color()` methods (@razvbir)
- Enh #259: Minor refactor `RadioList::renderUncheckInput()` and `CheckboxList::renderUncheckInput()` methods (@vjik)

## 3.11.0 June 10, 2025

Expand Down
8 changes: 4 additions & 4 deletions src/Widget/CheckboxList/CheckboxList.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function render(): string

$html = [];
if ($this->uncheckValue !== null) {
$html[] = $this->renderUncheckInput();
$html[] = $this->renderUncheckInput($this->uncheckValue);
}
if (!empty($this->containerTag)) {
$html[] = Html::openTag($this->containerTag, $this->containerAttributes);
Expand All @@ -333,12 +333,12 @@ public function render(): string
return implode("\n", $html);
}

private function renderUncheckInput(): string
private function renderUncheckInput(string $uncheckValue): string
{
return
Input::hidden(
Html::getNonArrayableName($this->name),
$this->uncheckValue,
$uncheckValue,
)
->addAttributes(
array_merge(
Expand All @@ -347,7 +347,7 @@ private function renderUncheckInput(): string
'disabled' => $this->checkboxAttributes['disabled'] ?? null,
'form' => $this->checkboxAttributes['form'] ?? null,
],
$this->individualInputAttributes[$this->uncheckValue] ?? [],
$this->individualInputAttributes[$uncheckValue] ?? [],
),
)
->render();
Expand Down
8 changes: 4 additions & 4 deletions src/Widget/RadioList/RadioList.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function render(): string

$html = [];
if ($this->uncheckValue !== null) {
$html[] = $this->renderUncheckInput();
$html[] = $this->renderUncheckInput($this->uncheckValue);
}
if (!empty($this->containerTag)) {
$html[] = Html::openTag($this->containerTag, $this->containerAttributes);
Expand All @@ -315,12 +315,12 @@ public function render(): string
return implode("\n", $html);
}

private function renderUncheckInput(): string
private function renderUncheckInput(string $uncheckValue): string
{
return
Input::hidden(
Html::getNonArrayableName($this->name),
$this->uncheckValue,
$uncheckValue,
)
->addAttributes(
array_merge(
Expand All @@ -329,7 +329,7 @@ private function renderUncheckInput(): string
'disabled' => $this->radioAttributes['disabled'] ?? null,
'form' => $this->radioAttributes['form'] ?? null,
],
$this->individualInputAttributes[$this->uncheckValue] ?? [],
$this->individualInputAttributes[$uncheckValue] ?? [],
),
)
->render();
Expand Down
Loading