reverted: --- b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php +++ a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/NumericItemBase.php @@ -61,19 +61,6 @@ '#description' => t("Define a string that should be suffixed to the value, like ' m', ' kb/s'. Leave blank for none. Separate singular and plural values with a pipe ('pound|pounds')."), ); - // Set the step for floating point and decimal numbers. - switch ($this->getFieldDefinition()->getType()) { - case 'decimal': - $element['min']['#step'] = pow(0.1, $settings['scale']); - $element['max']['#step'] = pow(0.1, $settings['scale']); - break; - - case 'float': - $element['min']['#step'] = 'any'; - $element['max']['#step'] = 'any'; - break; - } - return $element; } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php @@ -94,6 +94,19 @@ public function storageSettingsForm(array &$form, FormStateInterface $form_state /** * {@inheritdoc} */ + public function fieldSettingsForm(array $form, FormStateInterface $form_state) { + $element = parent::fieldSettingsForm($form, $form_state); + $settings = $this->getSettings(); + + $element['min']['#step'] = pow(0.1, $settings['scale']); + $element['max']['#step'] = pow(0.1, $settings['scale']); + + return $element; + } + + /** + * {@inheritdoc} + */ public function preSave() { $this->value = round($this->value, $this->getSetting('scale')); } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/FloatItem.php @@ -9,6 +9,7 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\TypedData\DataDefinition; /** @@ -51,6 +52,18 @@ public static function schema(FieldStorageDefinitionInterface $field_definition) /** * {@inheritdoc} */ + public function fieldSettingsForm(array $form, FormStateInterface $form_state) { + $element = parent::fieldSettingsForm($form, $form_state); + + $element['min']['#step'] = 'any'; + $element['max']['#step'] = 'any'; + + return $element; + } + + /** + * {@inheritdoc} + */ public static function generateSampleValue(FieldDefinitionInterface $field_definition) { $settings = $field_definition->getSettings(); $precision = rand(10, 32);