Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: ref. EZP-26382

...

This FieldType stores numeric values which will be provided as floats.

Input expectations

TypeExample
float

194079.572

Validation

This FieldType validates if the value provided is not lower or higher than the minimum and maximum limits defined in the FieldType settings.

Settings

The field definition of this FieldType can be configured with two options:

NameTypeDefault valueDescription
minFloatValuefloatfalseThis setting defines the minimum value this FieldType will allow as input.
maxFloatValuefloatfalseThis setting defines the maximum value this FieldType will allow as input.
Code Block
languagephp
titleFloat FieldType example settings
$settings = array(
	"minFloatValue" => 0.1,
	"maxFloatValue" => 203.99
);

 

...

The FieldType expects a number as input. Both decimal and integer numbers are accepted.

TypeExample
float

194079.572

int144

Value object

...

Properties

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

...

Code Block
languagephp
titleValue object content example
linenumberstrue
use eZ\Publish\Core\FieldType\Float\Type;

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

$float->value = 284.773

Constructor

The The Float\Value constructor will initialize a new Value object with the value provided. It expects a numeric value with or without decimals.

Code Block
languagephp
titleConstructor example
linenumberstrue
use eZ\Publish\Core\FieldType\Float\Type;

// Instantiates a Float Value object
$floatValue = new FloatType\Value( 284.773 );

Validation

...

This FieldType supports FloatValueValidator, defining maximal and minimal float value:

NameTypeDefault valueDescription
minFloatValuefloatfalse /
Status
colourYellow
titlesince 5.4.9
null
This setting defines the minimum value this FieldType will allow as input.
maxFloatValuefloatfalse /
Status
colourYellow
titlesince 5.4.9
null
This setting defines the maximum value this FieldType will allow as input.
Code Block
languagephp
titleValidator configuration example in PHP
linenumberstrue
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 does not support settings.