Problem/Motivation

The link field Title (disabled/optional/required) instance setting is not migrating from D7 to D8.

Proposed resolution

The D7 setting values (disabled/optional/required) need to be mapped to the D8 values (0/1/2).

Remaining tasks

Map the Title settings in the plugin transform() function.

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#27 d7_link_field_instance_settings-2678612-27.patch7.36 KBjofitz
#27 interdiff.txt681 bytesjofitz
#25 d7_link_field_instance_settings-2678612-25.patch7.36 KBjofitz
#25 interdiff.txt6.93 KBjofitz
#21 d7_link_field_instance_settings-2678612-21.patch1.89 KBjofitz
#21 interdiff.txt1.74 KBjofitz
#16 d7_link_field_instance_settings-2678612-16-complete.patch1.76 KBjofitz
#16 d7_link_field_instance_settings-2678612-16-tests.patch744 bytesjofitz
#11 d7_link_field_instance_settings-2678612-11-complete.patch2.29 KBjofitz
#11 d7_link_field_instance_settings-2678612-11-tests.patch744 bytesjofitz
#8 d7_link_field_instance_settings-2678612-8-complete.patch2.29 KBjofitz
#8 d7_link_field_instance_settings-2678612-8-tests.patch744 bytesjofitz
#2 d7_link_field_instance_settings-2678612-2.patch775 bytesjofitz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jo Fitzgerald created an issue. See original summary.

jofitz’s picture

Map the D7 settings to the D8 settings.

jofitz’s picture

Status: Active » Needs review
quietone’s picture

Issue tags: +migrate-d7-d8
benjy’s picture

This should be done in \Drupal\link\Plugin\migrate\cckfield\LinkField but that would be blocked on #2631736: Cckfield Plugins must distinguish core versions

Happy with the current approach for now if we can add some tests?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

benjy’s picture

Status: Needs review » Needs work

This needs looking at again now that #2631736: Cckfield Plugins must distinguish core versions is in.

jofitz’s picture

  • Added test.
  • Moved change to \Drupal\link\Plugin\migrate\cckfield\LinkField, as recommended by @benjy.

The last submitted patch, 8: d7_link_field_instance_settings-2678612-8-tests.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 8: d7_link_field_instance_settings-2678612-8-complete.patch, failed testing.

The last submitted patch, 11: d7_link_field_instance_settings-2678612-11-tests.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 11: d7_link_field_instance_settings-2678612-11-complete.patch, failed testing.

jofitz’s picture

Status: Needs work » Postponed
Related issues: +#2674090: Unable to migrate D7 link fields

Postponing this issue until #2674090: Unable to migrate D7 link fields has been resolved.

jofitz’s picture

Assigned: Unassigned » jofitz
Status: Postponed » Needs work

The last submitted patch, 16: d7_link_field_instance_settings-2678612-16-tests.patch, failed testing.

jofitz’s picture

Assigned: jofitz » Unassigned

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

phenaproxima’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs review » Needs work
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
@@ -131,4 +131,10 @@ public function testFieldInstances() {
+  public function testLinkFieldInstances() {
+    /** @var \Drupal\field\FieldConfigInterface $field */
+    $field = FieldConfig::load('node.test_content_type.field_link');
+    $this->assertEquals(1, $field->getSetting('title'));
+  }

I'd prefer if these assertions were part of the main test method -- otherwise it's going to actually do the entire setup and execute all migrations again for this method.

Let's also use assertSame() here, since it's more precise (if the migration set the title setting to TRUE, this assertion would still pass even though the actual data would be wrong). Additionally, I'd prefer if we could assert against an actual class constant, if there is one, rather than a numeric value.

Beyond these concerns, I think this looks good. RTBC one the changes are made and tests are passing.

jofitz’s picture

Thanks for the review @phenaproxima. I have made all the changes you suggested:

  1. Moved assertion to main test method (test now runs in less than half the time!)
  2. assertSame() used instead of assertEquals().
  3. Found the actual class constant to assert against.
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

I assume Drupal CI will pass this, so RTBC from me.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/link/src/Plugin/migrate/cckfield/d7/LinkField.php
@@ -27,4 +28,21 @@ public function getFieldWidgetMap() {
+    $process[0] = [

Why the [0] here?

+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php
@@ -131,6 +131,9 @@ public function testFieldInstances() {
+    $this->assertSame(DRUPAL_OPTIONAL, $field->getSetting('title'));

+++ b/core/modules/link/src/Plugin/migrate/cckfield/d7/LinkField.php
@@ -27,4 +28,21 @@ public function getFieldWidgetMap() {
+        'disabled' => DRUPAL_DISABLED,
+        'optional' => DRUPAL_OPTIONAL,
+        'required' => DRUPAL_REQUIRED,

It'd be great to have test coverage of all of the values.

jofitz’s picture

Assigned: Unassigned » jofitz
Status: Needs review » Needs work

On it...

jofitz’s picture

Status: Needs review » Needs work

The last submitted patch, 25: d7_link_field_instance_settings-2678612-25.patch, failed testing.

jofitz’s picture

Status: Needs work » Needs review
FileSize
681 bytes
7.36 KB

The less said about that, the better!

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 057d3dc to 8.3.x and 497d2aa to 8.2.x. Thanks!

  • alexpott committed 057d3dc on 8.3.x
    Issue #2678612 by Jo Fitzgerald, phenaproxima, benjy: D7 link field...

  • alexpott committed 497d2aa on 8.2.x
    Issue #2678612 by Jo Fitzgerald, phenaproxima, benjy: D7 link field...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.