Checkbox Field Type: comparison of v.2 vs v.3
Versions Compared
Old Version 2
changes.mady.by.user Dominika Kurek
Saved on Apr 29, 2016
compared with
New Version 3
changes.mady.by.user Dominika Kurek
Saved on Apr 29, 2016
- Previous Change: Difference between versions 1 and 2
- Next Change: Difference between versions 3 and 4
- View Page History
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This field type represents a Checkbox status, checked or unchecked.
| Name | Internal name | Expected input type |
|---|---|---|
| Checkbox | ezboolean | boolean |
Table of contents:
| Table of Contents | ||
|---|---|---|
|
Description
The Checkbox Field Type stores the current status for a checkbox input, checked of unchecked, by storing a boolean value.
Value object
Properties
The Value class of this Field Type contains the following properties:
| Property | Type | Default value | Description |
|---|---|---|---|
| $bool | boolean | false | This property will be used for the checkbox status, which will be represented by a boolean value. |
| Code Block | ||||||
|---|---|---|---|---|---|---|
|
||||||
use eZ\Publish\Core\FieldType\Checkbox\Type; // Instantiates a checkbox value with a default state (false) $checkboxValue = new Checkbox\Value(); // Checked $value->bool = true; // Unchecked $value->bool = false; |
Constructor
The Checkbox\Value constructor accepts an array of selected elements identifiers.
| Code Block | ||||||
|---|---|---|---|---|---|---|
|
||||||
use eZ\Publish\Core\FieldType\Checkbox\Type; // Instantiates a checkbox value with a checked state $checkboxValue = new Checkbox\Value( true ); |
String representation
As this Field Type is not a string but a bool, it will return "1" (true) or "0" (false) in cases where it is cast to string.
Comments
Add a comment