Commit dc15bf2e authored by webchick's avatar webchick

Issue #2216565 by ianthomas_uk: Remove wrappers for SortArray.

parent f45195e4
......@@ -4461,50 +4461,6 @@ function drupal_render_cid_create($elements) {
return FALSE;
}
/**
* Sorts a structured array by '#weight' property.
*
* Callback for uasort() within element_children().
*
* @param $a
* First item for comparison. The compared items should be associative arrays
* that optionally include a '#weight' key.
* @param $b
* Second item for comparison.
*
* @return int
* The comparison result for uasort().
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal\Component\Utility\SortArray::sortByWeightProperty().
*/
function element_sort($a, $b) {
return SortArray::sortByWeightProperty($a, $b);
}
/**
* Sorts a structured array by '#title' property.
*
* Callback for uasort() within:
* - system_modules()
* - theme_simpletest_test_table()
*
* @param $a
* First item for comparison. The compared items should be associative arrays
* that optionally include a '#title' key.
* @param $b
* Second item for comparison.
*
* @return int
* The comparison result for uasort().
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal\Component\Utility\SortArray::sortByTitleProperty().
*/
function element_sort_by_title($a, $b) {
return SortArray::sortByTitleProperty($a, $b);
}
/**
* Retrieves the default properties for the defined element type.
*
......@@ -4546,27 +4502,6 @@ function element_info_property($type, $property_name, $default = NULL) {
return (($info = element_info($type)) && array_key_exists($property_name, $info)) ? $info[$property_name] : $default;
}
/**
* Sorts a structured array by 'title' key (no # prefix).
*
* Callback for uasort() within system_admin_index().
*
* @param $a
* First item for comparison. The compared items should be associative arrays
* that optionally include a 'title' key.
* @param $b
* Second item for comparison.
*
* @return int
* The comparison result for uasort().
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal\Component\Utility\SortArray::sortByTitleElement().
*/
function drupal_sort_title($a, $b) {
return SortArray::sortByTitleElement($a, $b);
}
/**
* Checks if the key is a property.
*
......
......@@ -74,7 +74,7 @@ public function form(array $form, array &$form_state) {
);
}
// Sort the list so the output is ordered by weight.
uasort($form['shortcuts']['links'], 'element_sort');
uasort($form['shortcuts']['links'], array('\Drupal\Component\Utility\SortArray', 'sortByWeightProperty'));
return $form;
}
......
......@@ -34,7 +34,7 @@ public function index() {
// Only display a section if there are any available tasks.
if ($admin_tasks = system_get_module_admin_tasks($module, $info->info)) {
// Sort links by title.
uasort($admin_tasks, 'drupal_sort_title');
uasort($admin_tasks, array('\Drupal\Component\Utility\SortArray', 'sortByTitleElement'));
// Move 'Configure permissions' links to the bottom of each section.
$permission_key = "user.admin.people.permissions.$module";
if (isset($admin_tasks[$permission_key])) {
......
......@@ -160,7 +160,7 @@ public function buildForm(array $form, array &$form_state) {
}
// Lastly, sort all packages by title.
uasort($form['modules'], 'element_sort_by_title');
uasort($form['modules'], array('\Drupal\Component\Utility\SortArray', 'sortByTitleProperty'));
$form['#attached']['library'][] = 'system/drupal.system.modules';
$form['actions'] = array('#type' => 'actions');
......
......@@ -196,7 +196,7 @@ function ($object) {
// Allow for altering of hook_toolbar().
\Drupal::moduleHandler()->alter('toolbar', $items);
// Sort the children.
uasort($items, 'element_sort');
uasort($items, array('\Drupal\Component\Utility\SortArray', 'sortByWeightProperty'));
// Merge in the original toolbar values.
$element = array_merge($element, $items);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment