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.
Follow-up from #2118245: [meta] Source classes for config entities.
Write a D6 source plugin + tests for CCK field instances.
Remaining tasks: hunt for variable_get calls in CCK 6.x with a name that contains the instance id. Such variables need to be added in prepareRow. See D6FilterFormats::prepareRow for variable get examples.
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff.txt | 4.8 KB | chx |
#8 | imp-create_source_field_instance-2121393-8.patch | 5.31 KB | fastangel |
#4 | imp-create_source_field_instance-2121393-4.patch | 5.11 KB | fastangel |
Comments
Comment #1
fastangel CreditAttribution: fastangel commentedCreated a first version and added a test with a field body (type field with multiple rows).
Comment #2
chx CreditAttribution: chx commentedThis is an excellent issue to use the new Drupal6SqlBase because the table name changes with the module version.
Comment #3
chx CreditAttribution: chx commentedfixing status.
Comment #4
fastangel CreditAttribution: fastangel commentedUpdated.
Comment #5
chx CreditAttribution: chx commentedI am sorry, I have explained this poorly. If you check content.module, it uses content_field_tablename for retrieving the table name depending on the module schema version. Drupal6SqlBase has a method to check for the module schema and so you can query the proper table.
Comment #6
marvil07 CreditAttribution: marvil07 commentedActually I guess that function exists only because it is used on install file.
Even if that is not the case, I will suggest to just simply require
version >= 6001
(reviewing cck git history, that change was introduced before 6.x-1.0-alpha1, so it's safe to assume it's in) onRequirementsInterface::checkRequirements()
. SeeDrupal6SqlBase::getModuleSchemaVersion()
for that check.Comment #7
marvil07 CreditAttribution: marvil07 commentedComment #8
fastangel CreditAttribution: fastangel commentedDone the last changes commented.
By the way, what happen with version before 6.x-1.0-alpha1?. We exclude from migrate? Should we say in some comment?
Comment #9
chx CreditAttribution: chx commentedWe were talking of a requirements interface that pre migrations every plugin (source, destination) can throw an exception in and the runner will skip that migration.
Comment #10
chx CreditAttribution: chx commentedSo I'd guess we should put in a requirements function that checks and throws an exception and then later we can wire it in with the interface.
Comment #11
fastangel CreditAttribution: fastangel commentedok. Then should I add a exception when the version is version < 6001. Right?
The code should be:
Comment #12
chx CreditAttribution: chx commentedI have committed this but please see the attached interdiff to see how much I needed to change this. (I am not talking of the TestFieldInstance, that's somewhat new and you might've not heard of it.)
Comment #13
fastangel CreditAttribution: fastangel commentedThanks. The code are changing so fast. I know that I need to stay into the weekly hangout to stay update.
Comment #14
chx CreditAttribution: chx commentedMy problem is, as I mentioned in #12 is not the new code. The problem is you are submitting code that clearly never ever has been tried -- because it contains numerous syntax errors. You can not use any expression in the default value of a property to boot.
Comment #15
chx CreditAttribution: chx commentedDo you need assistance with running phpunit tests?
try
Comment #16
chx CreditAttribution: chx commentedI am reopening this to review any variables that might need to be added in prepareRow.
Comment #17
fastangel CreditAttribution: fastangel commentedAny relevant variable to use. See grep in cck:
Comment #18
chx CreditAttribution: chx commented> 'content_extra_weights_'. $info->old_type
Looks suspicious. What is this used for? D7 core allowed reordering of the fields and stored that in variables too. Is this the same?
Comment #19
chx CreditAttribution: chx commentedMore on D7: field_ui_display_overview_form_submit calls field_bundle_settings which sets / gets the variable
field_bundle_settings_' . $entity_type . '__' . $bundle
and from field_ui_display_overview_form_submit it is plain the weight is stored in that variable:Under D8, I would recommend trying to install field ui play with it a little -- weights should be in the entity.display.$this->entity_type . '.' . $this->bundle . '.' . $mode file .
In short, if that weight is indeed the same as in D7 then it needs to be added to the instance and then we can deal with it later when we migrate instances into instances and display entities.
Comment #20
marvil07 CreditAttribution: marvil07 commentedReflecting issue status
Comment #21
fastangel CreditAttribution: fastangel commentedI was doing some test here. And yes the weight is the same. Then we need to check the variable with height and map. Let me work on this.
Comment #22
fastangel CreditAttribution: fastangel commentedUhmm I was checking again in D6. http://api.drupalize.me/api/drupal/function/content_field_overview_form/6 overview in D6 isn't use variable. The only variable is used for extra _weight with custom fields implemented with extra weights instead field api. Then I think that this issue should be postponed to D7. What do you think?
Comment #23
Gábor HojtsyIs this to cover all of CCK migrations? Or just the fields that have been built in D6 (like node body mentioned above) and made optional in D7/8? Hard to grok the scope from the summary / discussion.
Comment #24
chx CreditAttribution: chx commentedThis is all written by now, even the test. And yes, it's CCK.