ChoiceListInterface
API reference › HTML Contracts › Form › ChoiceListInterface
Implemented by 1 type
Defines the contract for form controls that render a list of choices.
Applies to grouped controls such as checkbox and radio lists. Wrapping each choice in its own <label> element is
exclusive to list controls, so enclosedByLabel() belongs to this contract rather than to a standalone one.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
enclosedByLabel() abstract | Sets whether each choice is wrapped by its own <label> element. | ChoiceListInterface |
isList() abstract | Identifies the control as one that renders a list of choices. | ChoiceListInterface |
Method details
Section titled “Method details”enclosedByLabel()
Section titled “enclosedByLabel() ”abstract public function enclosedByLabel(bool $value = true): staticSets whether each choice is wrapped by its own <label> element.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether to enclose each choice by a <label> element. |
Returns
static: New instance with the updated enclosing behavior.
isList()
Section titled “isList() ”abstract public function isList(): trueIdentifies the control as one that renders a list of choices.
Returns
true: Always true.