Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Checkbox::labelPlacement() #364

Merged
merged 6 commits into from
Oct 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix themes
vjik committed Oct 3, 2024

Verified

This commit was signed with the committer’s verified signature.
vjik Sergei Predvoditelev
commit 56d1d69f12ffa8846ac191c7f2da045e89769356
5 changes: 3 additions & 2 deletions config/theme-bootstrap5-horizontal.php
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
use Yiisoft\Form\Field\Button;
use Yiisoft\Form\Field\ButtonGroup;
use Yiisoft\Form\Field\Checkbox;
use Yiisoft\Form\Field\CheckboxLabelPlacement;
use Yiisoft\Form\Field\CheckboxList;
use Yiisoft\Form\Field\ErrorSummary;
use Yiisoft\Form\Field\RadioList;
@@ -24,8 +25,8 @@
'inputInvalidClass' => 'is-invalid',
'fieldConfigs' => [
Checkbox::class => [
'inputContainerTag()' => ['div'],
'addInputContainerClass()' => ['form-check'],
'labelPlacement()' => [CheckboxLabelPlacement::SIDE],
'addContainerClass()' => ['form-check'],
'inputClass()' => ['form-check-input'],
'inputLabelClass()' => ['form-check-label'],
],
5 changes: 3 additions & 2 deletions config/theme-bootstrap5-vertical.php
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
use Yiisoft\Form\Field\Button;
use Yiisoft\Form\Field\ButtonGroup;
use Yiisoft\Form\Field\Checkbox;
use Yiisoft\Form\Field\CheckboxLabelPlacement;
use Yiisoft\Form\Field\CheckboxList;
use Yiisoft\Form\Field\ErrorSummary;
use Yiisoft\Form\Field\RadioList;
@@ -24,8 +25,8 @@
'inputInvalidClass' => 'is-invalid',
'fieldConfigs' => [
Checkbox::class => [
'inputContainerTag()' => ['div'],
'addInputContainerClass()' => ['form-check'],
'labelPlacement()' => [CheckboxLabelPlacement::SIDE],
'addContainerClass()' => ['form-check'],
'inputClass()' => ['form-check-input'],
'inputLabelClass()' => ['form-check-label'],
],

Unchanged files with check annotations Beta

->label($label, $this->inputLabelAttributes)
->labelEncode($this->inputLabelEncode);
} elseif ($labelPlacement === CheckboxLabelPlacement::SIDE) {
$label = $this->inputLabel ?? $this->label ?? $this->getInputData()->getLabel();

Check warning on line 257 in src/Field/Checkbox.php

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Coalesce": --- Original +++ New @@ @@ $label = $this->inputLabel ?? $this->label ?? $this->getInputData()->getLabel(); $checkbox = $checkbox->label($label, $this->inputLabelAttributes)->labelEncode($this->inputLabelEncode); } elseif ($labelPlacement === CheckboxLabelPlacement::SIDE) { - $label = $this->inputLabel ?? $this->label ?? $this->getInputData()->getLabel(); + $label = $this->inputLabel ?? $this->getInputData()->getLabel() ?? $this->label; $checkbox = $checkbox->sideLabel($label, $this->inputLabelAttributes)->labelEncode($this->inputLabelEncode); } $html = $checkbox->checked($inputValue === $value)->uncheckValue($this->uncheckValue)->render();

Check warning on line 257 in src/Field/Checkbox.php

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "Coalesce": --- Original +++ New @@ @@ $label = $this->inputLabel ?? $this->label ?? $this->getInputData()->getLabel(); $checkbox = $checkbox->label($label, $this->inputLabelAttributes)->labelEncode($this->inputLabelEncode); } elseif ($labelPlacement === CheckboxLabelPlacement::SIDE) { - $label = $this->inputLabel ?? $this->label ?? $this->getInputData()->getLabel(); + $label = $this->label ?? $this->inputLabel ?? $this->getInputData()->getLabel(); $checkbox = $checkbox->sideLabel($label, $this->inputLabelAttributes)->labelEncode($this->inputLabelEncode); } $html = $checkbox->checked($inputValue === $value)->uncheckValue($this->uncheckValue)->render();
$checkbox = $checkbox
->sideLabel($label, $this->inputLabelAttributes)
->labelEncode($this->inputLabelEncode);