Loading CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx #3105343 by Kionn, DenisCi: Maintenance mode message shown on settings forms when site is not in maintenance mode. #3102582 by DamienMcKenna, dbourrion: Change uses of http:// to https://. #3101532 by DamienMcKenna, heddn, slv_: Only attach Metatag migration field logic on '\''Drupal 7'\'' migrations, e.g. core upgrades. Metatag 8.x-1.11, 2019-12-20 Loading metatag.module +89 −57 Original line number Diff line number Diff line Loading @@ -723,7 +723,7 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M /** * Implements hook_migration_plugins_alter(). */ function metatag_migration_plugins_alter(array &$migrations) { function metatag_migration_plugins_alter(array &$definitions) { // This is used for guided migrations from Drupal 7 using either core's // Migrate Drupal UI or the Migrate Upgrade contributed module. It will // automatically create a field named "field_metatag" with the per-entity Loading @@ -735,8 +735,48 @@ function metatag_migration_plugins_alter(array &$migrations) { // // @see metatag_migrate_prepare_row() // @see Drupal\metatag\Plugin\migrate\process\d7\MetatagD7 foreach ($migrations as &$migration) { if (isset($migration['destination']['plugin'])) { foreach ($definitions as &$definition) { // Only certain migrate plugins are supported. if (_metatag_is_migration_plugin_supported($definition)) { // Metatag-D7's data is handled via a custom process plugin that does // the data conversion. $definition['process']['field_metatag'] = [ 'plugin' => 'd7_metatag_entities', 'source' => 'pseudo_d7_metatag_entities', ]; // List dependencies here so that they are processed first, otherwise // the destination field won't be available for the data to go into. $definition['migration_dependencies']['optional'][] = 'd7_metatag_field'; $definition['migration_dependencies']['optional'][] = 'd7_metatag_field_instance'; } } } /** * Check if a given migrate plugin should have Metatag's logic added. * * @param array $definition * The migration plugin definition to examine. * * @return bool * Indicates whether Metatag's custom migration logic should be added for this * migrate plugin definition * * @see metatag_migration_plugins_alter() */ function _metatag_is_migration_plugin_supported(array $definition) { // Only run add the migration plugins when doing a "Drupal 7" migration. This // will catch standard core migrations but allow skipping this log for custom // migrations that do not have this tag. if (!empty($definition['migration_tags'])) { if (!in_array('Drupal 7', $definition['migration_tags'])) { return FALSE; } } // This migration has destination plugins defined. if (!empty($definition['destination']['plugin'])) { // Follow logic on hook_entity_base_field_info() and exclude the metatag // entity itself, plus some others. $destinations_to_ignore = [ Loading Loading @@ -771,28 +811,20 @@ function metatag_migration_plugins_alter(array &$migrations) { 'url_alias', 'user_data', ]; if (in_array($migration['destination']['plugin'], $destinations_to_ignore)) { continue; if (in_array($definition['destination']['plugin'], $destinations_to_ignore)) { return FALSE; } } // Load the destination plugin. // Only support content entity destinations. $plugin_definition = \Drupal::service('plugin.manager.migrate.destination') ->getDefinition($migration['destination']['plugin']); $destination_plugin = DefaultFactory::getPluginClass($migration['destination']['plugin'], $plugin_definition); if (is_subclass_of($destination_plugin, EntityContentBase::class) || $destination_plugin == EntityContentBase::class) { // Metatag-D7's data is handled via a custom process plugin that does // the data conversion. $migration['process']['field_metatag'] = [ 'plugin' => 'd7_metatag_entities', 'source' => 'pseudo_d7_metatag_entities', ]; // List dependencies here so that they are processed first, otherwise // the destination field won't be available for the data to go into. $migration['migration_dependencies']['optional'][] = 'd7_metatag_field'; $migration['migration_dependencies']['optional'][] = 'd7_metatag_field_instance'; } } ->getDefinition($definition['destination']['plugin']); $destination_plugin = DefaultFactory::getPluginClass($definition['destination']['plugin'], $plugin_definition); if (!is_subclass_of($destination_plugin, EntityContentBase::class) && $destination_plugin != EntityContentBase::class) { return FALSE; } // If this stage is reached then this is a supported core migration and the // Metatag migration will be automatically handled. return TRUE; } tests/src/Kernel/Migrate/d7/MigrateMetatagD7EntitiesTest.php→tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; * * @group metatag */ class MigrateMetatagD7EntitiesTest extends MigrateDrupal7TestBase { class MetatagEntitiesTest extends MigrateDrupal7TestBase { /** * {@inheritdoc} Loading tests/src/Unit/Migrate/d7/MetatagD7FieldInstanceTest.php→tests/src/Unit/Migrate/d7/MetatagFieldInstanceTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; * * @group metatag */ class MetatagD7FieldInstanceTest extends MigrateSqlSourceTestCase { class MetatagFieldInstanceTest extends MigrateSqlSourceTestCase { const PLUGIN_CLASS = 'Drupal\metatag\Plugin\migrate\source\d7\MetatagFieldInstance'; Loading tests/src/Unit/Migrate/d7/MetatagD7FieldTest.php→tests/src/Unit/Migrate/d7/MetatagFieldTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; * * @group metatag */ class MetatagD7FieldTest extends MigrateSqlSourceTestCase { class MetatagFieldTest extends MigrateSqlSourceTestCase { const PLUGIN_CLASS = 'Drupal\metatag\Plugin\migrate\source\d7\MetatagField'; Loading Loading
CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx #3105343 by Kionn, DenisCi: Maintenance mode message shown on settings forms when site is not in maintenance mode. #3102582 by DamienMcKenna, dbourrion: Change uses of http:// to https://. #3101532 by DamienMcKenna, heddn, slv_: Only attach Metatag migration field logic on '\''Drupal 7'\'' migrations, e.g. core upgrades. Metatag 8.x-1.11, 2019-12-20 Loading
metatag.module +89 −57 Original line number Diff line number Diff line Loading @@ -723,7 +723,7 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M /** * Implements hook_migration_plugins_alter(). */ function metatag_migration_plugins_alter(array &$migrations) { function metatag_migration_plugins_alter(array &$definitions) { // This is used for guided migrations from Drupal 7 using either core's // Migrate Drupal UI or the Migrate Upgrade contributed module. It will // automatically create a field named "field_metatag" with the per-entity Loading @@ -735,8 +735,48 @@ function metatag_migration_plugins_alter(array &$migrations) { // // @see metatag_migrate_prepare_row() // @see Drupal\metatag\Plugin\migrate\process\d7\MetatagD7 foreach ($migrations as &$migration) { if (isset($migration['destination']['plugin'])) { foreach ($definitions as &$definition) { // Only certain migrate plugins are supported. if (_metatag_is_migration_plugin_supported($definition)) { // Metatag-D7's data is handled via a custom process plugin that does // the data conversion. $definition['process']['field_metatag'] = [ 'plugin' => 'd7_metatag_entities', 'source' => 'pseudo_d7_metatag_entities', ]; // List dependencies here so that they are processed first, otherwise // the destination field won't be available for the data to go into. $definition['migration_dependencies']['optional'][] = 'd7_metatag_field'; $definition['migration_dependencies']['optional'][] = 'd7_metatag_field_instance'; } } } /** * Check if a given migrate plugin should have Metatag's logic added. * * @param array $definition * The migration plugin definition to examine. * * @return bool * Indicates whether Metatag's custom migration logic should be added for this * migrate plugin definition * * @see metatag_migration_plugins_alter() */ function _metatag_is_migration_plugin_supported(array $definition) { // Only run add the migration plugins when doing a "Drupal 7" migration. This // will catch standard core migrations but allow skipping this log for custom // migrations that do not have this tag. if (!empty($definition['migration_tags'])) { if (!in_array('Drupal 7', $definition['migration_tags'])) { return FALSE; } } // This migration has destination plugins defined. if (!empty($definition['destination']['plugin'])) { // Follow logic on hook_entity_base_field_info() and exclude the metatag // entity itself, plus some others. $destinations_to_ignore = [ Loading Loading @@ -771,28 +811,20 @@ function metatag_migration_plugins_alter(array &$migrations) { 'url_alias', 'user_data', ]; if (in_array($migration['destination']['plugin'], $destinations_to_ignore)) { continue; if (in_array($definition['destination']['plugin'], $destinations_to_ignore)) { return FALSE; } } // Load the destination plugin. // Only support content entity destinations. $plugin_definition = \Drupal::service('plugin.manager.migrate.destination') ->getDefinition($migration['destination']['plugin']); $destination_plugin = DefaultFactory::getPluginClass($migration['destination']['plugin'], $plugin_definition); if (is_subclass_of($destination_plugin, EntityContentBase::class) || $destination_plugin == EntityContentBase::class) { // Metatag-D7's data is handled via a custom process plugin that does // the data conversion. $migration['process']['field_metatag'] = [ 'plugin' => 'd7_metatag_entities', 'source' => 'pseudo_d7_metatag_entities', ]; // List dependencies here so that they are processed first, otherwise // the destination field won't be available for the data to go into. $migration['migration_dependencies']['optional'][] = 'd7_metatag_field'; $migration['migration_dependencies']['optional'][] = 'd7_metatag_field_instance'; } } ->getDefinition($definition['destination']['plugin']); $destination_plugin = DefaultFactory::getPluginClass($definition['destination']['plugin'], $plugin_definition); if (!is_subclass_of($destination_plugin, EntityContentBase::class) && $destination_plugin != EntityContentBase::class) { return FALSE; } // If this stage is reached then this is a supported core migration and the // Metatag migration will be automatically handled. return TRUE; }
tests/src/Kernel/Migrate/d7/MigrateMetatagD7EntitiesTest.php→tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; * * @group metatag */ class MigrateMetatagD7EntitiesTest extends MigrateDrupal7TestBase { class MetatagEntitiesTest extends MigrateDrupal7TestBase { /** * {@inheritdoc} Loading
tests/src/Unit/Migrate/d7/MetatagD7FieldInstanceTest.php→tests/src/Unit/Migrate/d7/MetatagFieldInstanceTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; * * @group metatag */ class MetatagD7FieldInstanceTest extends MigrateSqlSourceTestCase { class MetatagFieldInstanceTest extends MigrateSqlSourceTestCase { const PLUGIN_CLASS = 'Drupal\metatag\Plugin\migrate\source\d7\MetatagFieldInstance'; Loading
tests/src/Unit/Migrate/d7/MetatagD7FieldTest.php→tests/src/Unit/Migrate/d7/MetatagFieldTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; * * @group metatag */ class MetatagD7FieldTest extends MigrateSqlSourceTestCase { class MetatagFieldTest extends MigrateSqlSourceTestCase { const PLUGIN_CLASS = 'Drupal\metatag\Plugin\migrate\source\d7\MetatagField'; Loading