protected static function DecimalItem::getDecimalDigits in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php \Drupal\Core\Field\Plugin\Field\FieldType\DecimalItem::getDecimalDigits()
Helper method to get the number of decimal digits out of a decimal number.
Parameters
int $decimal: The number to calculate the number of decimals digits from.
Return value
int The number of decimal digits.
1 call to DecimalItem::getDecimalDigits()
- DecimalItem::generateSampleValue in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ DecimalItem.php - Generates placeholder field values.
File
- core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ DecimalItem.php, line 171 - Contains \Drupal\Core\Field\Plugin\Field\FieldType\DecimalItem.
Class
- DecimalItem
- Defines the 'decimal' field type.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
protected static function getDecimalDigits($decimal) {
$digits = 0;
while ($decimal - round($decimal)) {
$decimal *= 10;
$digits++;
}
return $digits;
}