Problem/Motivation
Nodeblocks attaches its data on the node entity with nodeblock_node_load()
. This allows its data to be exported and imported across environments with the Migrate module. However when importing data, the nodeblock property is not registered as a valid property on the node entity and therefor the Migrate module skips this data when importing the node.
Proposed resolution
By registering 'nodeblock' as a valid property on the entity, Migrate (as well as other modules that work with entity metadata) will save the property with the rest of the node data and the nodeblock data transfers successfully across environments.
Remaining tasks
- Write a patch
- Review
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#1 | nodeblock-register_entity_property-2420555-1.patch | 1.29 KB | idebr |
Comments
Comment #1
idebr CreditAttribution: idebr commentedAttached patch register nodeblock as a node property, so its data is saved correctly by modules that validate entity properties such as Migrate.
Comment #2
Johnny vd Laar CreditAttribution: Johnny vd Laar at ezCompany commentedThe info array is keyed by entity types. nodeblock is not an entity type. Are you sure that your code is working? Shouldn't type be 'node' ? And you iterate over properties... but shoudn't we just be adding the nodeblock property?
I also think it should be inside a hook_entity_property_info.
And the n00b question... how do I test this. I never use migrate so what should I enable to see how this works.