Problem/Motivation
Some of Migrate’s cckfield plugin's method naming are not describing clear enough what they do and therefore may confuse developers using the API (therefore giving poor DX).
Proposed resolution
- Rename processFieldValues() to defineValueProcessPipeline()
- Rename processField() to alterFieldMigration()/li>
- Rename processFieldInstance() to alterFieldInstanceMigration()
- Rename processFieldWidget() to alterFieldWidgetMigration()
- Rename processFieldFormatter() to alterFieldFormatterMigration()
- Update tests
- Add BC layer
Remaining tasks
Review
Commit
User interface changes
None.
API changes
Yes.
processCckFieldValues()
will be deprecatedThis wad deprecated in #2683435: CCK does not exist in Drupal 7, rename Migrate's cckfield plugins to field pluginsprocessFieldValues()
will be deprecatedprocessField()
will be deprecatedprocessFieldInstance()
will be deprecatedprocessFieldWidget()
will be deprecatedprocessFieldFormatter()
will be deprecated
Data model changes
None.
Original report
Those who know me know that I’m fairly fanatical about good DX in core APIs (or, indeed, any APIs). Because of that, certain aspects of Migrate’s cckfield plugins have been bugging me for a long time.
I have three main bones to pick:
- processField() is poorly named. Its actual purpose is altering the migrations that transform CCK fields (in D6) and Field API field definitions (in D7) into D8 field_storage_config entities. This should be renamed to processFieldMigration() or alterFieldMigration().
- processFieldInstance() has the same problem. It should be called processFieldInstanceMigration() or alterFieldInstanceMigration().
- processCckFieldValues() is on another planet entirely. Its purpose is to define the processing pipeline for values of the field type that the plugin handles, but this does not come through at all in the method name. I think this should be called something like defineFieldValueProcess() or defineValueProcessPipline().
The doc blocks for each of these methods in MigrateCckFieldInterface need to be improved as well. These plugins are crucial for contrib migrations from D6 and D7, so the interface should include short snippets of example code in the doc comments.