diff --git a/core/includes/common.inc b/core/includes/common.inc index 82ceaaa..8499c4c 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1267,7 +1267,7 @@ function drupal_get_updaters() { if (!isset($updaters)) { $updaters = \Drupal::moduleHandler()->invokeAll('updater_info'); \Drupal::moduleHandler()->alter('updater_info', $updaters); - \Drupal\Component\Utility\SortArray::drupalUASort($updaters, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($updaters, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); } return $updaters; } @@ -1287,7 +1287,7 @@ function drupal_get_filetransfer_info() { if (!isset($info)) { $info = \Drupal::moduleHandler()->invokeAll('filetransfer_info'); \Drupal::moduleHandler()->alter('filetransfer_info', $info); - \Drupal\Component\Utility\SortArray::drupalUASort($info, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($info, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); } return $info; } diff --git a/core/includes/update.inc b/core/includes/update.inc index 1f317aa..beed1c9 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -9,6 +9,7 @@ */ use Drupal\Component\Graph\Graph; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Utility\Error; /** @@ -400,7 +401,7 @@ function update_resolve_dependencies($starting_updates) { // Perform the depth-first search and sort on the results. $graph_object = new Graph($graph); $graph = $graph_object->searchAndSort(); - \Drupal\Component\Utility\SortArray::drupalUASort($graph, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($graph, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); foreach ($graph as $function => &$data) { $module = $data['module']; diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php index f4aec40..ea07386 100644 --- a/core/lib/Drupal/Component/Utility/SortArray.php +++ b/core/lib/Drupal/Component/Utility/SortArray.php @@ -144,7 +144,8 @@ public static function sortByKeyInt($a, $b, $key) { /** * Custom UASort for Drupal. * - * In case if items are equal or if the specified sorting key is no set it will preserve the original order. + * In case if items are equal or if the specified sorting key is no set it + * will preserve the original order. * * @param array $items * The items diff --git a/core/lib/Drupal/Core/Entity/EntityListBuilder.php b/core/lib/Drupal/Core/Entity/EntityListBuilder.php index 66e034e..9a8999e 100644 --- a/core/lib/Drupal/Core/Entity/EntityListBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Entity; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Component\Utility\SortArray; /** * Defines a generic implementation to build a listing of entities. @@ -127,7 +128,7 @@ public function getOperations(EntityInterface $entity) { $operations = $this->getDefaultOperations($entity); $operations += $this->moduleHandler()->invokeAll('entity_operation', array($entity)); $this->moduleHandler->alter('entity_operation', $operations, $entity); - \Drupal\Component\Utility\SortArray::drupalUASort($operations, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); + SortArray::drupalUASort($operations, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); return $operations; } diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php index b88df13..b4f2b41 100644 --- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php +++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Entity\EntityReferenceSelection; use Drupal\Component\Plugin\FallbackPluginManagerInterface; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\FieldDefinitionInterface; @@ -67,7 +68,7 @@ public function getPluginId($target_type, $base_plugin_id) { $selection_handler_groups = $this->getSelectionGroups($target_type); // Sort the selection plugins by weight and select the best match. - \Drupal\Component\Utility\SortArray::drupalUASort($selection_handler_groups[$base_plugin_id], array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($selection_handler_groups[$base_plugin_id], array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); end($selection_handler_groups[$base_plugin_id]); $plugin_id = key($selection_handler_groups[$base_plugin_id]); diff --git a/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/core/lib/Drupal/Core/Field/FormatterPluginManager.php index 6ecf534..29e1a82 100644 --- a/core/lib/Drupal/Core/Field/FormatterPluginManager.php +++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Field; use Drupal\Component\Plugin\Factory\DefaultFactory; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; @@ -176,7 +177,7 @@ public function getOptions($field_type = NULL) { $options = array(); $field_types = $this->fieldTypeManager->getDefinitions(); $formatter_types = $this->getDefinitions(); - \Drupal\Component\Utility\SortArray::drupalUASort($formatter_types, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($formatter_types, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); foreach ($formatter_types as $name => $formatter_type) { foreach ($formatter_type['field_types'] as $formatter_field_type) { // Check that the field type exists. diff --git a/core/lib/Drupal/Core/Field/WidgetPluginManager.php b/core/lib/Drupal/Core/Field/WidgetPluginManager.php index f878bc6..b8cc0fa 100644 --- a/core/lib/Drupal/Core/Field/WidgetPluginManager.php +++ b/core/lib/Drupal/Core/Field/WidgetPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Field; use Drupal\Component\Plugin\Factory\DefaultFactory; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; @@ -176,7 +177,7 @@ public function getOptions($field_type = NULL) { $options = array(); $field_types = $this->fieldTypeManager->getDefinitions(); $widget_types = $this->getDefinitions(); - \Drupal\Component\Utility\SortArray::drupalUASort($widget_types, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($widget_types, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); foreach ($widget_types as $name => $widget_type) { foreach ($widget_type['field_types'] as $widget_field_type) { // Check that the field type exists. diff --git a/core/modules/breakpoint/src/BreakpointManager.php b/core/modules/breakpoint/src/BreakpointManager.php index ca05965..9653e15 100644 --- a/core/modules/breakpoint/src/BreakpointManager.php +++ b/core/modules/breakpoint/src/BreakpointManager.php @@ -7,6 +7,7 @@ namespace Drupal\breakpoint; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -164,7 +165,7 @@ public function getBreakpointsByGroup($group) { $breakpoints[$plugin_id] = $plugin_definition; } } - \Drupal\Component\Utility\SortArray::drupalUASort($breakpoints, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($breakpoints, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); $this->cacheBackend->set($this->cacheKey . ':' . $group, $breakpoints, Cache::PERMANENT, array('breakpoints')); $this->breakpointsByGroup[$group] = $breakpoints; } diff --git a/core/modules/config/src/Tests/ConfigEntityListTest.php b/core/modules/config/src/Tests/ConfigEntityListTest.php index 92f1971..65746e2 100644 --- a/core/modules/config/src/Tests/ConfigEntityListTest.php +++ b/core/modules/config/src/Tests/ConfigEntityListTest.php @@ -9,6 +9,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\config_test\Entity\ConfigTest; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Entity\EntityStorageInterface; /** @@ -75,7 +76,7 @@ function testList() { $actual_operations = $controller->getOperations($entity); // Sort the operations to normalize link order. - \Drupal\Component\Utility\SortArray::drupalUASort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); $this->assertEqual($expected_operations, $actual_operations, 'The operations are identical.'); // Test buildHeader() method. @@ -145,7 +146,7 @@ function testList() { $actual_operations = $controller->getOperations($entity); // Sort the operations to normalize link order. - \Drupal\Component\Utility\SortArray::drupalUASort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($actual_operations, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); $this->assertEqual($expected_operations, $actual_operations, 'The operations are identical.'); } diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationMapperList.php b/core/modules/config_translation/src/Controller/ConfigTranslationMapperList.php index 37fdd8e..3f4a29e 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationMapperList.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationMapperList.php @@ -7,6 +7,7 @@ namespace Drupal\config_translation\Controller; +use Drupal\Component\Utility\SortArray; use Drupal\config_translation\ConfigMapperInterface; use Drupal\Core\Controller\ControllerBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -124,7 +125,7 @@ public function buildHeader() { protected function buildOperations(ConfigMapperInterface $mapper) { // Retrieve and sort operations. $operations = $mapper->getOperations(); - \Drupal\Component\Utility\SortArray::drupalUASort($operations, 'Drupal\Component\Utility\SortArray::sortByWeightElement'); + SortArray::drupalUASort($operations, 'Drupal\Component\Utility\SortArray::sortByWeightElement'); $build = array( '#type' => 'operations', '#links' => $operations, diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index d111019..127524c 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -10,6 +10,7 @@ use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityWithPluginCollectionInterface; @@ -784,7 +785,7 @@ public function reduceOrder($array, $a) { $array[] = $a['name']; } if (!empty($a['children'])) { - \Drupal\Component\Utility\SortArray::drupalUASort($a['children'], array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($a['children'], array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); $array = array_merge($array, array_reduce($a['children'], array($this, 'reduceOrder'))); } return $array; diff --git a/core/modules/system/src/Controller/AdminController.php b/core/modules/system/src/Controller/AdminController.php index efd93e3..1915dce 100644 --- a/core/modules/system/src/Controller/AdminController.php +++ b/core/modules/system/src/Controller/AdminController.php @@ -7,6 +7,7 @@ namespace Drupal\system\Controller; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Controller\ControllerBase; /** @@ -34,7 +35,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. - \Drupal\Component\Utility\SortArray::drupalUASort($admin_tasks, array('\Drupal\Component\Utility\SortArray', 'sortByTitleElement')); + SortArray::drupalUASort($admin_tasks, array('\Drupal\Component\Utility\SortArray', 'sortByTitleElement')); // Move 'Configure permissions' links to the bottom of each section. $permission_key = "user.admin_permissions.$module"; if (isset($admin_tasks[$permission_key])) { diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index e68b233..43fe3bf 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -7,6 +7,7 @@ namespace Drupal\system\Form; +use Drupal\Component\Utility\SortArray; use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\PreExistingConfigException; use Drupal\Core\Config\UnmetDependenciesException; @@ -178,7 +179,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { } // Lastly, sort all packages by title. - \Drupal\Component\Utility\SortArray::drupalUASort($form['modules'], array('\Drupal\Component\Utility\SortArray', 'sortByTitleProperty')); + SortArray::drupalUASort($form['modules'], array('\Drupal\Component\Utility\SortArray', 'sortByTitleProperty')); $form['#attached']['library'][] = 'system/drupal.system.modules'; $form['actions'] = array('#type' => 'actions'); diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index a2c3a32..2c4aed0 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -7,6 +7,7 @@ namespace Drupal\taxonomy\Form; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -383,7 +384,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular */ public function submitForm(array &$form, FormStateInterface $form_state) { // Sort term order based on weight. - \Drupal\Component\Utility\SortArray::drupalUASort($form_state->getValue('terms'), array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($form_state->getValue('terms'), array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); $vocabulary = $form_state->get(['taxonomy', 'vocabulary']); // Update the current hierarchy type as we go. diff --git a/core/modules/toolbar/src/Element/Toolbar.php b/core/modules/toolbar/src/Element/Toolbar.php index f576623..041bbe0 100644 --- a/core/modules/toolbar/src/Element/Toolbar.php +++ b/core/modules/toolbar/src/Element/Toolbar.php @@ -8,6 +8,7 @@ namespace Drupal\toolbar\Element; use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Render\Element\RenderElement; use Drupal\Core\Render\Element; @@ -87,7 +88,7 @@ public static function preRenderToolbar($element) { // Allow for altering of hook_toolbar(). $module_handler->alter('toolbar', $items); // Sort the children. - \Drupal\Component\Utility\SortArray::drupalUASort($items, array('\Drupal\Component\Utility\SortArray', 'sortByWeightProperty')); + SortArray::drupalUASort($items, array('\Drupal\Component\Utility\SortArray', 'sortByWeightProperty')); // Merge in the original toolbar values. $element = array_merge($element, $items); diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index 8706561..c59baea 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -15,6 +15,7 @@ use Drupal\user\RoleInterface; use Drupal\views\Plugin\views\HandlerBase; use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\SortArray; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ViewExecutable; @@ -686,7 +687,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) { protected function buildGroupSubmit($form, FormStateInterface $form_state) { $groups = array(); $group_items = $form_state->getValue(array('options', 'group_info', 'group_items')); - \Drupal\Component\Utility\SortArray::drupalUASort($group_items, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + SortArray::drupalUASort($group_items, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); // Filter out removed items. // Start from 1 to avoid problems with #default_value in the widget. diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php index ff0f4a6..c10fc6a 100644 --- a/core/modules/views_ui/src/ViewFormBase.php +++ b/core/modules/views_ui/src/ViewFormBase.php @@ -7,6 +7,7 @@ namespace Drupal\views_ui; +use Drupal\Component\Utility\SortArray; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Form\FormStateInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -55,7 +56,7 @@ protected function prepareEntity() { if (empty($this->displayID)) { // If a display isn't specified, use the first one after sorting by // #weight. - \Drupal\Component\Utility\SortArray::drupalUASort($tabs, 'Drupal\Component\Utility\SortArray::sortByWeightProperty'); + SortArray::drupalUASort($tabs, 'Drupal\Component\Utility\SortArray::sortByWeightProperty'); foreach ($tabs as $id => $tab) { if (!isset($tab['#access']) || $tab['#access']) { $this->displayID = $id;