You are here

protected function MigrateFieldPluginManager::sortDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager::sortDefinitions()
  2. 10 core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager::sortDefinitions()

Sorts a definitions array.

This sorts the definitions array first by the weight column, and then by the plugin ID, ensuring a stable, deterministic, and testable ordering of plugins.

Parameters

array $definitions: The definitions array to sort.

1 call to MigrateFieldPluginManager::sortDefinitions()
MigrateFieldPluginManager::findDefinitions in core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
Finds plugin definitions.

File

core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php, line 109

Class

MigrateFieldPluginManager
Plugin manager for migrate field plugins.

Namespace

Drupal\migrate_drupal\Plugin

Code

protected function sortDefinitions(array &$definitions) {
  array_multisort(array_column($definitions, 'weight'), SORT_ASC, SORT_NUMERIC, array_keys($definitions), SORT_ASC, SORT_NATURAL, $definitions);
}