Commit 4e257500 authored by Wim Leers's avatar Wim Leers Committed by heddn
Browse files

Issue #3100285 by Wim Leers, heddn:...

Issue #3100285 by Wim Leers, heddn: \Drupal\migrate_plus\Entity\Migration::createEntityFromPlugin() was last updated in 2016, is incomplete
parent 1c1bcc41
......@@ -79,12 +79,21 @@ class Migration extends ConfigEntityBase implements MigrationInterface {
*
* @return \Drupal\migrate_plus\Entity\MigrationInterface
* A Migration configuration entity (not saved to persistent storage).
*
* Note the list of properties being transplanted from the plugin instance or
* definition into the Migration config entity must remain in sync with the
* keys listed in the "config_export" annotation key of this class.
*/
public static function createEntityFromPlugin($plugin_id, $new_plugin_id) {
/** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager */
$plugin_manager = \Drupal::service('plugin.manager.migration');
$migration_plugin = $plugin_manager->createInstance($plugin_id);
$entity_array['id'] = $new_plugin_id;
$plugin_definition = $migration_plugin->getPluginDefinition();
$migration_details['class'] = $plugin_definition['class'];
if (isset($plugin_definition['field_plugin_method'])) {
$migration_details['field_plugin_method'] = $plugin_definition['field_plugin_method'];
}
$entity_array['migration_tags'] = $migration_plugin->get('migration_tags');
$entity_array['label'] = $migration_plugin->label();
$entity_array['source'] = $migration_plugin->getSourceConfiguration();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment