You are here

class FloatData in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/Plugin/DataType/FloatData.php \Drupal\Core\TypedData\Plugin\DataType\FloatData
  2. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/FloatData.php \Drupal\Core\TypedData\Plugin\DataType\FloatData

The float data type.

The plain value of a float is a regular PHP float. For setting the value any PHP variable that casts to a float may be passed.

Plugin annotation


@DataType(
  id = "float",
  label = @Translation("Float")
)

Hierarchy

  • class \Drupal\Core\TypedData\Plugin\DataType\FloatData extends \Drupal\Core\TypedData\PrimitiveBase implements \Drupal\Core\TypedData\Type\FloatInterface

Expanded class hierarchy of FloatData

1 string reference to 'FloatData'
core.data_types.schema.yml in core/config/schema/core.data_types.schema.yml
core/config/schema/core.data_types.schema.yml

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/FloatData.php, line 19

Namespace

Drupal\Core\TypedData\Plugin\DataType
View source
class FloatData extends PrimitiveBase implements FloatInterface {

  /**
   * {@inheritdoc}
   */
  public function getCastedValue() {
    return (double) $this->value;
  }

}

Members