Issue #2216565 by ianthomas_uk: Remove wrappers for SortArray.

8.0.x
webchick 2014-03-24 07:44:46 -07:00
parent f45195e4b6
commit dc15bf2eb2
5 changed files with 4 additions and 69 deletions

View File

@ -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.
*

View File

@ -74,7 +74,7 @@ class SetCustomize extends EntityFormController {
);
}
// 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;
}

View File

@ -34,7 +34,7 @@ class AdminController extends ControllerBase {
// 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])) {

View File

@ -160,7 +160,7 @@ class ModulesListForm extends FormBase {
}
// 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');

View File

@ -196,7 +196,7 @@ function toolbar_pre_render($element) {
// 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);