Message-ID: <619449208.3890.1485855802878.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3889_493223650.1485855802878" ------=_Part_3889_493223650.1485855802878 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html The Checkbox FieldType

The Checkbox FieldType

This field type represents a Checkbox status, checked or uncheck= ed.

Name Internal name Expected input type
Checkbox ezboolean boolean

Table of contents:

=20 =20

Description


The Checkbox FieldType stores the current stat= us for a checkbox input, checked of unchecked, by storing a boolean value.<= /p>

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 stat= us, which will be represented by a boolean value.
Value object content examples
=20
use eZ\Publish\Core\FieldType\Checkbox\Type;
 
// Instantiates a checkbox value with a default state (false)
$checkboxValue =3D new Checkbox\Value();
 
// Checked
$value->bool =3D true;=20
=20
// Unchecked
$value->bool =3D false;
=20

Constructor

The Checkbox\Value constructor acce= pts an array of selected elements identifiers.

Constructor example
=20
use eZ\Publish\Core\FieldType\Checkbox\Type;
 
// Instantiates a checkbox value with a checked state
$checkboxValue =3D new Checkbox\Value( true );
=20

String representation<= /h3>

As this FieldType is not a string but a bool, it will return "1" (true) = or "0" (false) in cases where it is casted to string.

 

------=_Part_3889_493223650.1485855802878--