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.
Problem/Motivation
Write a field migration plugin to map Drupal7's `blockreference` field from Blockreference module to `block_field` field of this module.
Comment | File | Size | Author |
---|---|---|---|
#13 | interdiff_10-13.txt | 718 bytes | n4r3n |
#13 | block_field-field_migration_plugin-3219319-13.patch | 3.69 KB | n4r3n |
| |||
#10 | interdiff_8-10.txt | 4.65 KB | n4r3n |
#10 | block_field-field_migration_plugin-3219319-10.patch | 3.69 KB | n4r3n |
| |||
#8 | block_field-field_migration_plugin-3219319-8.patch | 7.78 KB | n4r3n |
|
Comments
Comment #2
n4r3nThis patch adds field migration plugin and related test-case.
Comment #3
huzookaVery nice!
Typo:
blockrefre
.I would also map
blockreference_without_title
toblock_field
; andblockreference_title
andblockreference_plain
toblock_field_label
I thought a lot about how to always use the current process pipeline from core
d7_block
here - I have no better idea yet than doing this.bypass
should be a booleanTRUE
, not a string.Since
block_plugin_id
performs a lookup in thed7_custom_block
migration, we should declare that the actual migration depends ond7_custom_block
(it should be a required migration dependency).See
\Drupal\migrate_drupal\Plugin\migrate\field\ReferenceBase::alterFieldInstanceMigration
.Missing class doc comment and wrong test group annotation.
This test does not add much value in its current state – basically it tests
Drupal\views\Plugin\views\field\FieldPluginBase
andDrupal\migrate\Plugin\Migration::mergeProcessOfProperty
Comment #4
huzookaComment #5
Wim LeersMarking #3, and especially for the missing migration dependency that @huzooka pointed out in point 5 of his review.
perComment #6
n4r3nThanks @huzooka and @wim for the inputs. Here I'm uploading updated patch and interdiff.
Comment #8
n4r3nFixing failed test case.
Comment #9
huzooka@n4r3n, Sorry for the long wait.
We only use the
d7_custom_block
migration when we try to migrate the actual field values, field instance migrations shouldn't depend ond7_custom_block
.You have to add this dependency in the
::defineValueProcessPipeline()
method.This is still a wrong annotation (it should be
block_field
, because the current module's machine name isblock_field
).But now seriously, this test class isn't testing the plugin, it is testing the underlying (Migrate Drupal) infrastructure. It is completely redundant in its current state. Either rethink how to test actual value migrations, or remove it.
p.s: Next time please generate an interdiff about the changes since the last review (or if you like it better, about each change).
Comment #10
n4r3nthank you for the review @huzooka. Here I'm uploading updated patch with interdiff.
Comment #11
n4r3nComment #12
huzookaComment line is longer than 80 characters. (Should be fixed before/on commit.)
Comment #13
n4r3nFixed PHPCS error