Skip to the content
Documentation

The Float Field Type: comparison of v.1 vs v.2

No ratings yet

Versions Compared

Old Version 1

changes.mady.by.user Petar Spanja

Saved on May 23, 2014

compared with

New Version Current

changes.mady.by.user Dominika Kurek

Saved on Jan 28, 2016

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This field type Field Type represents a float value.

...

Table of Contents
minLevel 2

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
language php
title Constructor example
linenumbers true
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
language php
title Validator configuration example in PHP
linenumbers true
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.

...

Comments

Add a comment

Comments are read by a moderator before they appear.