Chris@0: getPluginDefinition()['migration_tags'])) { Chris@0: foreach ($migration->getPluginDefinition()['migration_tags'] as $tag) { Chris@0: if ($tag == 'Drupal 7') { Chris@0: $core = 7; Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: $definitions = $this->getDefinitions(); Chris@0: foreach ($definitions as $plugin_id => $definition) { Chris@0: if (in_array($core, $definition['core'])) { Chris@0: if (array_key_exists($field_type, $definition['type_map']) || $field_type === $plugin_id) { Chris@0: return $plugin_id; Chris@0: } Chris@0: } Chris@0: } Chris@0: throw new PluginNotFoundException($field_type); Chris@0: } Chris@0: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public function processDefinition(&$definition, $plugin_id) { Chris@14: parent::processDefinition($definition, $plugin_id); Chris@14: Chris@14: foreach (['core', 'source_module', 'destination_module'] as $required_property) { Chris@14: if (empty($definition[$required_property])) { Chris@14: throw new BadPluginDefinitionException($plugin_id, $required_property); Chris@14: } Chris@14: } Chris@14: } Chris@14: Chris@18: /** Chris@18: * {@inheritdoc} Chris@18: */ Chris@18: protected function findDefinitions() { Chris@18: $definitions = parent::findDefinitions(); Chris@18: $this->sortDefinitions($definitions); Chris@18: return $definitions; Chris@18: } Chris@18: Chris@18: /** Chris@18: * Sorts a definitions array. Chris@18: * Chris@18: * This sorts the definitions array first by the weight column, and then by Chris@18: * the plugin ID, ensuring a stable, deterministic, and testable ordering of Chris@18: * plugins. Chris@18: * Chris@18: * @param array $definitions Chris@18: * The definitions array to sort. Chris@18: */ Chris@18: protected function sortDefinitions(array &$definitions) { Chris@18: array_multisort(array_column($definitions, 'weight'), SORT_ASC, SORT_NUMERIC, array_keys($definitions), SORT_ASC, SORT_NATURAL, $definitions); Chris@18: } Chris@18: Chris@0: }