This field type represents a float value.
| Name | Internal name | Expected input |
|---|---|---|
Float | ezfloat | float |
Table of contents:

This FieldType stores numeric values which will be provided as floats.
The FieldType expects a number as input. Both decimal and integer numbers are accepted.
| Type | Example |
|---|---|
float |
|
int | 144 |
The Value class of this field type contains the following properties:
| Property | Type | Description |
|---|---|---|
$value | float | This property will be used to store the value provided as a float. |
use eZ\Publish\Core\FieldType\Float\Type; // Instantiates a Float Value object $floatValue = new Type\Value(); $float->value = 284.773 |
The Float\Value constructor will initialize a new Value object with the value provided. It expects a numeric value with or without decimals.
use eZ\Publish\Core\FieldType\Float\Type; // Instantiates a Float Value object $floatValue = new Type\Value( 284.773 ); |
This FieldType supports FloatValueValidator, defining maximal and minimal float value:
| Name | Type | Default value | Description |
|---|---|---|---|
minFloatValue | float | false | This setting defines the minimum value this FieldType will allow as input. |
maxFloatValue | float | false | This setting defines the maximum value this FieldType will allow as input. |
use eZ\Publish\Core\FieldType\Float\Type;
$contentTypeService = $repository->getContentTypeService();
$floatFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct( "float", "ezfloat" );
// Accept only numbers between 0.1 and 203.99
$floatFieldCreateStruct->validatorConfiguration = array(
"FileSizeValidator" => array(
"minFloatValue" => 0.1,
"maxFloatValue" => 203.99
)
); |
This FieldType does not support settings.