only in patch2: unchanged: --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -787,7 +787,7 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state // Assign a decimal placeholder weight to preserve original array order. if (!isset($element[$key]['#weight'])) { - $element[$key]['#weight'] = $count/1000; + $element[$key]['#weight'] = $count; } else { // If one of the child elements has a weight then we will need to sort only in patch2: unchanged: --- a/core/lib/Drupal/Core/Render/Element/Checkboxes.php +++ b/core/lib/Drupal/Core/Render/Element/Checkboxes.php @@ -64,7 +64,7 @@ public static function processCheckboxes(&$element, FormStateInterface $form_sta // Maintain order of options as defined in #options, in case the element // defines custom option sub-elements, but does not define all option // sub-elements. - $weight += 0.001; + $weight ++; $element += array($key => array()); $element[$key] += array( only in patch2: unchanged: --- a/core/lib/Drupal/Core/Render/Element/Radios.php +++ b/core/lib/Drupal/Core/Render/Element/Radios.php @@ -49,7 +49,7 @@ public static function processRadios(&$element, FormStateInterface $form_state, // Maintain order of options as defined in #options, in case the element // defines custom option sub-elements, but does not define all option // sub-elements. - $weight += 0.001; + $weight ++; $element += array($key => array()); // Generate the parents as the autogenerator does, so we will have a only in patch2: unchanged: --- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php +++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php @@ -206,7 +206,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#type' => 'item', '#title' => t('Maximum image resolution'), '#element_validate' => array(array(get_class($this), 'validateResolution')), - '#weight' => 4.1, + '#weight' => 41, '#field_prefix' => '
', '#field_suffix' => '
', '#description' => t('The maximum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of EXIF data in the image.', array('@url' => 'http://en.wikipedia.org/wiki/Exchangeable_image_file_format')), @@ -233,7 +233,7 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#type' => 'item', '#title' => t('Minimum image resolution'), '#element_validate' => array(array(get_class($this), 'validateResolution')), - '#weight' => 4.2, + '#weight' => 42, '#field_prefix' => '
', '#field_suffix' => '
', '#description' => t('The minimum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.'), @@ -264,14 +264,14 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => t('Enable Alt field'), '#default_value' => $settings['alt_field'], '#description' => t('The alt attribute may be used by search engines, screen readers, and when the image cannot be loaded. Enabling this field is recommended'), - '#weight' => 9, + '#weight' => 90, ); $element['alt_field_required'] = array( '#type' => 'checkbox', '#title' => t('Alt field required'), '#default_value' => $settings['alt_field_required'], '#description' => t('Making this field required is recommended.'), - '#weight' => 10, + '#weight' => 100, '#states' => array( 'visible' => array( ':input[name="field[settings][alt_field]"]' => array('checked' => TRUE), @@ -283,13 +283,13 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) { '#title' => t('Enable Title field'), '#default_value' => $settings['title_field'], '#description' => t('The title attribute is used as a tooltip when the mouse hovers over the image. Enabling this field is not recommended as it can cause problems with screen readers.'), - '#weight' => 11, + '#weight' => 110, ); $element['title_field_required'] = array( '#type' => 'checkbox', '#title' => t('Title field required'), '#default_value' => $settings['title_field_required'], - '#weight' => 12, + '#weight' => 120, '#states' => array( 'visible' => array( ':input[name="field[settings][title_field]"]' => array('checked' => TRUE), only in patch2: unchanged: --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -1152,7 +1152,7 @@ public static function addMicroweights(&$build) { $count = 0; foreach (Element::children($build) as $key) { if (!isset($build[$key]['#weight'])) { - $build[$key]['#weight'] = $count/1000; + $build[$key]['#weight'] = $count; } static::addMicroweights($build[$key]); $count++; only in patch2: unchanged: --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php @@ -40,7 +40,7 @@ function testGrouper() { 'group' => -100, 'every_page' => TRUE, 'type' => 'file', - 'weight' => 0.012, + 'weight' => 12, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'core/modules/system/system.base.css', @@ -51,7 +51,7 @@ function testGrouper() { 'group' => -100, 'every_page' => TRUE, 'type' => 'file', - 'weight' => 0.013, + 'weight' => 13, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'core/modules/system/system.theme.css', @@ -61,7 +61,7 @@ function testGrouper() { 'jquery.ui.core.css' => array( 'group' => -100, 'type' => 'file', - 'weight' => 0.004, + 'weight' => 4, 'every_page' => FALSE, 'media' => 'all', 'preprocess' => TRUE, @@ -73,7 +73,7 @@ function testGrouper() { 'every_page' => TRUE, 'group' => 0, 'type' => 'file', - 'weight' => 0.011, + 'weight' => 11, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'core/modules/field/theme/field.css', @@ -84,7 +84,7 @@ function testGrouper() { 'every_page' => FALSE, 'group' => 0, 'type' => 'external', - 'weight' => 0.009, + 'weight' => 9, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'http://example.com/external.css', @@ -96,7 +96,7 @@ function testGrouper() { 'every_page' => TRUE, 'media' => 'all', 'type' => 'file', - 'weight' => 0.001, + 'weight' => 1, 'preprocess' => TRUE, 'data' => 'core/themes/bartik/css/base/elements.css', 'browsers' => array('IE' => TRUE, '!IE' => TRUE), @@ -107,7 +107,7 @@ function testGrouper() { 'every_page' => TRUE, 'media' => 'print', 'type' => 'file', - 'weight' => 0.003, + 'weight' => 3, 'preprocess' => TRUE, 'data' => 'core/themes/bartik/css/print.css', 'browsers' => array('IE' => TRUE, '!IE' => TRUE),