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

Float Field Type

=20
=20
=20
=20

This Field Type represents a float value.

Name Internal name Expected input
Float ezfloat float

Description=

This Field Type stores numeric values which will be provided as floats.<= /p>

PHP API Field Type 

Input expectations

The Field Type expects a number as in= put. Both decimal and integer numbers are accepted.

Type Example
float

194079.572

int 144

Value object

Properties

The Value class of this field type contains the following properties:

Property Type Description
$value float This property will be used to stor= e the value provided as a float.
Value object content example
=20
use eZ\Publish\Core\FieldType\Float\Type;

// Instantiates a Float Value object
$floatValue =3D new Type\Value();

$float->value =3D 284.773
=20
Constructor

The Float\Value constructor will&nbs= p;initialize a new Value object with the value provided. It expects a numer= ic value with or without decimals.

Constructor example
=20
use eZ\Publish\Core\FieldType\Float\Type;

// Instantiates a Float Value object
$floatValue =3D new Type\Value( 284.773 );
=20

Validation

This Field Type supports FloatValueValidator, defining maximal and minimal float value:

Name Type Default value Description
minFloatValue float null
<= /td>
This setting defines the minimum value this Fiel= dType will allow as input.
maxFloatValue float null
This setting defines the maximum v= alue this FieldType will allow as input.
Validator configuration example in PHP
=20
use eZ\Publish\Core\FieldType\Float\Type;
 =20
$contentTypeService =3D $repository->getContentTypeService();
$floatFieldCreateStruct =3D $contentTypeService->newFieldDefinitionCreat=
eStruct( "float", "ezfloat" );
=20
// Accept only numbers between 0.1 and 203.99
$floatFieldCreateStruct->validatorConfiguration =3D array(
    "FileSizeValidator" =3D> array(=09
=09=09"minFloatValue" =3D> 0.1,
=09=09"maxFloatValue" =3D> 203.99
    )
);
=20

Settings

This Field Type does not support settings.

 

=20
=20
=20
=20

 

=20
=20
=20
------=_Part_4119_881031658.1485857796722--