Problem/Motivation

Some block settings are not imported when running the procedure in the parent issue:

  1. Show block for specific roles: I also tried adding the d6_user_role migration to the manifest, but it still did not import this setting.
  2. Title: It imports the default (in code) title, but not the customized (in the D6 database) title.
  3. Display title: I'd assume that this should be unchecked if the D6 block had a title of "[none]" (with arrows instead of brackets), but it is always checked after import.

Proposed resolution

  1. When importing data from the D6 blocks table, use the value from the title column if available. Unless it is "[none]" (with arrows) in which case the "Display title" should be unchecked.
  2. When importing data from the D6 blocks table also join with blocks_roles and get those mapped roles as well.

Remaining tasks

Implement that logic/query.

User interface changes

API changes

Original report by @brockfanning

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brockfanning’s picture

Issue summary: View changes
brockfanning’s picture

Issue summary: View changes
brockfanning’s picture

Title: Some block settings not imported » D6->D8 Blocks - role settings and custom titles not imported
Issue summary: View changes
brockfanning’s picture

Issue summary: View changes
ultimike’s picture

Assigned: Unassigned » ultimike

Role-based visibility settings is fixed with #2415399: D6->D8 migration: User role based block visibility settings not migrated properly.

I confirmed with a manual test that the D6 "Block title" isn't properly migrated to D8. The D6 "Block description" is copied (incorrectly) into the D8 title field, and while the D8 "Display title" checkbox is checked, the title isn't actually displayed. When I manually re-saved the block configuration (with no changes), the (incorrect) block title is displayed.

I'll go ahead and start working on a patch to:

  1. Properly migrate the block title.
  2. Set the D8 "Display title" checkbox properly depending on the incoming value of the D6 "Block title". I'll need to check to make sure that both custom and module-based block titles are handled properly.

-mike

ultimike’s picture

Title: D6->D8 Blocks - role settings and custom titles not imported » D6->D8 Blocks - Custom titles not imported
Assigned: ultimike » Unassigned
Status: Active » Needs review
FileSize
3.53 KB
484.9 KB

Patch attached.

-mike

benjy’s picture

This looks good to me, how about a failing version of the patch to prove the tests work?

ultimike’s picture

FileSize
483.24 KB

Good idea. Fail patch attached.

-mike

Status: Needs review » Needs work

The last submitted patch, 8: 2281393-8-FAIL.patch, failed testing.

tadityar’s picture

Status: Needs work » Needs review

The failed patch was purposely created to fail, moving to needs review.

benjy’s picture

+++ b/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/BlockSettings.php
@@ -24,8 +24,11 @@ class BlockSettings extends ProcessPluginBase {
+    if ($title != '<none>') {
+      $settings['label'] = $title;
+    }

This implies that $settings['title'] isn't set at all if title is < none>. Is that right?

ultimike’s picture

FileSize
485.52 KB
4.15 KB
2.42 KB

Good catch. Actually, I totally missed the D8 block $settings['label_display'] setting. Updated patch includes support for this setting.

Also - I noticed that my re-roll of #2410623: D6-D8 Custom Block Migration not visible in region failed to include core/modules/migrate_drupal/src/Tests/.gitattributes, so I've added it to this patch as well.

-mike

ultimike’s picture

Status: Needs review » Needs work

The last submitted patch, 13: 2281393-13-FAIL.patch, failed testing.

ultimike’s picture

Status: Needs work » Needs review

Setting to "Needs review" as the FAIL test was meant to fail.

-mike

mrjmd’s picture

Didn't get to do a full functional review, but it looks like one of your new lines in MigrateBlockTest.php got appended onto an existing line (for all three versions). I've new versions with that fixed.

The last submitted patch, 16: 2281393-16-FAIL.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 16: 2281393-16.patch, failed testing.

mrjmd’s picture

Hmm let me try that again.

mrjmd’s picture

Status: Needs work » Needs review

The last submitted patch, 19: 2281393-19-FAIL.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 19: 2281393-19.patch, failed testing.

ultimike’s picture

Status: Needs work » Needs review
FileSize
510.23 KB
4.16 KB

@mrjmd - good find, thanks! Not sure why your patch wasn't applying - did you create it with git diff --full-index --binary > filename.patch?

Patch updated.

-mike

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

anavarre’s picture

+1 - Works really well.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/BlockSettings.php
    @@ -24,8 +24,16 @@ class BlockSettings extends ProcessPluginBase {
    +      $settings['label_display'] = 'visible';
    

    There's a constant for this. See BLOCK_LABEL_VISIBLE

  2. +++ b/core/modules/migrate_drupal/src/Tests/.gitattributes
    @@ -0,0 +1 @@
    +d6.gz -text -diff
    \ No newline at end of file
    

    New line needed

Xano’s picture

Status: Needs work » Needs review
FileSize
1.24 KB
510.44 KB
benjy’s picture

Status: Needs review » Reviewed & tested by the community

Seems to fix the concerns from #26, thanks.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: drupal_2281393_27.patch, failed testing.

mrjmd’s picture

Status: Needs work » Needs review
FileSize
510.45 KB

Here's a straight reroll of #27. There was a minor conflict in BlockSettings.php caused by the switch to MigrateExecutableInterface, pretty sure I've resolved it properly.

benjy’s picture

Can we get an interdiff?

mrjmd’s picture

FileSize
617 bytes

Interdiff.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, still RTBC for me

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/BlockSettings.php
@@ -24,8 +25,16 @@ class BlockSettings extends ProcessPluginBase {
diff --git a/core/modules/migrate_drupal/src/Tests/.gitattributes b/core/modules/migrate_drupal/src/Tests/.gitattributes

diff --git a/core/modules/migrate_drupal/src/Tests/.gitattributes b/core/modules/migrate_drupal/src/Tests/.gitattributes
new file mode 100644

new file mode 100644
index 0000000000000000000000000000000000000000..2423bbb9253483cf409d2b03e81f0796c3af3fe1

index 0000000000000000000000000000000000000000..2423bbb9253483cf409d2b03e81f0796c3af3fe1
--- /dev/null

--- /dev/null
+++ b/core/modules/migrate_drupal/src/Tests/.gitattributes

+++ b/core/modules/migrate_drupal/src/Tests/.gitattributes
+++ b/core/modules/migrate_drupal/src/Tests/.gitattributes
@@ -0,0 +1 @@

@@ -0,0 +1 @@
+d6.gz -text -diff

Adding this means you can no longer produce migrate patches just using git diff without doing git diff --binary. This should be discussed in a different issue.

ultimike’s picture

I think that we only need to use git diff --binary when there is a change to a test that involved a change to the source DB (d6.gz in this case), this has been the case since #2348875: Improving our dump files.

I guess I'm not clear on why that stops this patch from getting committed?

On a related note, I just created #2452709: migrate_drupal test dump generation documentation to improve the dump generation documentation.

-mike

douggreen’s picture

Can you just switch from storing the file as a .gz and instead use a .sql?

ultimike’s picture

ultimike’s picture

Status: Needs work » Postponed
bdone’s picture

FileSize
82.04 KB

trying a re-roll, using the now RTBC'd #2469623: Process for creating migration source DBs for automated tests. not sure about this diff yet, since this is a new process for me.

bdone’s picture

FileSize
694.94 KB

correcting for block id (bid) 8 and so we can diff patches in this new process.

vendion’s picture

FileSize
627.66 KB

This is a secondary diff correcting block id 8.

bdone’s picture

Status: Postponed » Needs review
FileSize
82.01 KB

worked with @vendion to get this new process working. this patch is from both of us and is the re-roll of #30, using the script generated dump from #2469623: Process for creating migration source DBs for automated tests.

Status: Needs review » Needs work

The last submitted patch, 42: 2281393-42.patch, failed testing.

bdone’s picture

quietone’s picture

Status: Needs work » Needs review
FileSize
3.79 KB

Reroll. The patch is much smalled because the patch in #42 had lots of changes to unrelated dump tables.

mikeryan queued 45: 2281393-45.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 45: 2281393-45.patch, failed testing.

quietone’s picture

Issue tags: +migrate-d6-d8
quietone’s picture

Status: Needs work » Needs review
FileSize
10.04 KB

Rerolled.

  • And added tests for the label and the label display.
  • Changed the process plugin, BlockSettings, to check for and empty title column, instead on 'none' as the patch had. Both D6 and D7 have an empty field when there is not title.
  • Made the same change to d7_block.yml.

Tested locally and worked fine.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to all three 8.x branches, thanks!

  • catch committed 3429084 on 8.2.x
    Issue #2281393 by ultimike, mrjmd, bdone, quietone, Xano, vendion, benjy...

  • catch committed a1a6ef3 on 8.0.x
    Issue #2281393 by ultimike, mrjmd, bdone, quietone, Xano, vendion, benjy...

Status: Fixed » Closed (fixed)

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

drzraf’s picture

this hunk seems to have been forgotten
D6's <none> labeled blocks must not have their label shown in D8

drzraf’s picture

ping for reopen @catch