This field type Field Type represents a float value.
...
| Table of Contents | ||
|---|---|---|
|
Description
This FieldType Field Type stores numeric values which will be provided as floats.
Input expectations
The FieldType Field Type expects a number as input. Both decimal and integer numbers are accepted.
...
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
use eZ\Publish\Core\FieldType\Float\Type; // Instantiates a Float Value object $floatValue = new Type\Value( 284.773 ); |
Validation
This FieldType Field Type supports FloatValueValidator, defining maximal and minimal float value:
...
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
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
)
); |
Settings
This FieldType Field Type does not support settings.
...
