Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps required to reproduce the bug:
- Create a new custom block on d6 at /admin/build/block/add.
- Set the "Show block on specific pages" radio to "Show on every page except the listed pages"
- Set the "Pages" field to 'admin'.
Expected behavior:
- Pages tab for the block in d8 should show:
'admin' in the Pages textarea and
'Hide for the listed pages' for the radio
What happened instead?
- Pages textarea was empty
- Neither radio option was selected
Comment | File | Size | Author |
---|---|---|---|
#10 | 2341683-block_visibility-10.patch | 5.01 KB | markie |
Comments
Comment #1
micnap CreditAttribution: micnap commentedComment #2
micnap CreditAttribution: micnap commentedComment #3
ultimikeHrm - we have test coverage for this in MigrateBlockTest - looking into it now...
-mike
Comment #4
ultimike@micnap - it looks like that if the block is disabled, then the page visibility settings aren't migrated - is this the same behavior you're seeing?
I manually tested this twice - once with a disabled block with page visibility settings and once with an enabled block (assigned to a region) with page visibility settings. I'm pretty sure we want to migrate the visibility settings regardless of if the block is disabled or not.
Also, I noticed that we aren't currently testing the role-based visibility settings (nor do they appear to be working). We define the "block_roles" table in the Drupal6Block dump file, but don't include any data for testing. I went ahead and added a some data and a (currently failing) assertion for this in MigrateBlockTest (patch attached).
This is a good issue for someone looking to get their feet wet in the Migrate in Core issue queue...
-mike
Comment #5
markie CreditAttribution: markie commentedComment #6
markie CreditAttribution: markie commentedOur story so far. The test successfully fails but there is a bigger issue we have discussed online. The migrate for blocks doesn't address importing user roles at all. I have added some functionality but the tests still fail and I am still not getting any good traction. So I offer a patch and a request for guidance.
Comment #7
benjy CreditAttribution: benjy commentedThis patch looks like a good start. Not sure why we you're setting this so deep, can't we just set the into the "roles" key? Like so: $this->setSourceProperty('roles', $roles);
I think maybe we are going to need a dependency on d6_user_role, even if it's only soft so we can get the new machine_name of each role.
Setting to NR for the bot.
Comment #10
markie CreditAttribution: markie commentedSorry for my lack of participation. Here's a re-roll. of 2341683-block_visibility-6. I tried
$this->setSourceProperty('roles', $roles);
but this still returned a negative test. Diving further into this tonight.Comment #12
ultimikeHmm - there's a lot going on with this issue...
Did we lose the original intention for this issue? Is the "Show block on specific pages" issue still valid? It looks like most of the discussion of this issue is around the role visibility. If so, we need to update the issue summary.
It's pretty clear that we need to add some code in order to migrate role visibility settings, and it is not so simple to do. Here's what a sample role visibility setting for a D8 block config looks like:
So, if role visibility is used on the source, then we need to build out this structure in the destination. Some questions/thoughts:
Thoughts?
-mike
Comment #13
ultimikeComment #14
benjy CreditAttribution: benjy commentedWould be good if someone could retest this now that #2358269: Migration bugs in block visibility, field overrides, cron, maintenance settings and form modes found by configuration schema checking has been committed.
Comment #15
ultimikeThe page related visibility settings are all working as far as I can tell.
There's an issue with the role visibility settings, but I'll open a new issue for that.
-mike