HtmlCaptionCheckboxListInput
extends CheckboxListInput
in package
`CheckboxList` that keeps Html in option captions.
IMPORTANT: Contributte CheckboxListInput::getControl() casts each caption with
(string) $caption and passes it to CheckboxInput::makeCheckbox(), which inserts it as text.
An Html caption becomes the string <span ...> and is shown to the user with its tags.
Nette itself handles Html captions (Helpers::createInputList() tests
instanceof HtmlStringable); they are lost in the Bootstrap layer. Without this class filter
option counts ("Sony (3)") could only be plain text and an option with count 0 could not get its own class.
Same pattern as FlatCheckboxInput.
Table of Contents
Methods
- getControl() : Html
- replaceCaption() : void
- Replaces the content of the inner `<label class="form-check-label">` with the Html caption.
Methods
getControl()
public
getControl() : Html
Return values
HtmlreplaceCaption()
Replaces the content of the inner `<label class="form-check-label">` with the Html caption.
private
replaceCaption(Html $wrapper, HtmlStringable $caption) : void
The structure from CheckboxInput::makeCheckbox() is
<label class="form-check"><input ...><label class="form-check-label">text</label></label>.
If it ever changes, the caption stays textual, which is the parent behavior, not an error.
Parameters
- $wrapper : Html
- $caption : HtmlStringable