function MigrateFieldPluginManager::sortDefinitions

Same name 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()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.