Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By kim.pepper on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
Several callbacks used for sorting arrays have been changed to be methods on Drupal\Component\Utility\SortArray. For example, drupal_sort_weight() has been replaced by SortArray::sortByWeightElement()
Drupal 7:
uasort($operations, 'drupal_sort_weight');
Drupal 8:
uasort($operations, ['Drupal\Component\Utility\SortArray', 'sortByWeightElement']);
Drupal 7 | Drupal 8 |
---|---|
drupal_sort_title() |
SortArray::sortByTitleElement() |
drupal_sort_weight() |
SortArray::sortByWeightElement() |
element_sort() |
SortArray::sortByWeightProperty() |
element_sort_by_title() |
SortArray::sortByTitleProperty() |
Impacts:
Module developers