Hi,
Your module is exactly what I'm looking for.
I haven't any bug. :-)
However it doesn't support Field_Collection both for export and import.
By the way, the support of "file" as sub field.
I'm open to contribute on this project.
Don't hesitate to contact me.
BR
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | import_export_field_collection.txt | 17.66 KB | sebastien m. |
| #5 | profile_maker_content.zip | 6.73 KB | sebastien m. |
Comments
Comment #1
bailey86 commentedThanks for getting in touch.
I'll need to look at this - maybe you could send through a rough plan you may have.
In the meantime you might find Bundle Copy - https://drupal.org/project/bundle_copy - to be of use for exporting/importing the field collections. I've heard it works with field collections but not tested it myself.
It might be that we can think of Field Collections as structure and not data - but I'm open to suggestions.
Comment #2
sebastien m. commentedTomorrow I will send you my implementation.
I have tested it and it seems to work with simple and complex cases.
Comment #3
rooby commentedFeature requests are for the dev version, priority is always normal for feature & support requests and the needs work status is for issues that have a patch and the patch still needs work.
See https://drupal.org/node/156119 and https://drupal.org/node/45111
Comment #4
bailey86 commentedHi,
I'm doing some work on the module currently so if you have a patch available do you want to send it through and I'll see about applying it.
Cheers,
Kevin B
Comment #5
sebastien m. commentedHi,
Currently I haven't any patch to apply, however, I can send you the code I'm using to build a node before sending it and the one to import the node.
Here is a description of each functions :
_profile_maker_content_get_field_by_type : this function return an array of fields filtered by type :
_profile_maker_content_export_nodes : this function prepare the content to be stored into file
_profile_maker_content_export_node : this function will select each node and encode/export it
(internally called by _profile_maker_content_export_nodes)
_profile_maker_content_export_node_recurse : this is the most important function. recursively, the node will be prepared before export
(internally called by _profile_maker_content_export_node)
Functions containing "import" will make the some work but in the other way.
As far as I remember, I haven't changed your function called "*import*with_defined_id".
Feel free to contact me for any question.
BR
cf : I made you an extract "import_export_field_collection.txt" of my module to highlight functions which match the more your code.
The full code is in the file "profile_maker_content.module".
Comment #6
bailey86 commentedI'm going to mark this as closed as field collections are structure and not data - and I'd prefer to keep the distinction clear.
I think there are other modules available which can export/import field collections.
Comment #7
sebastien m. commentedField collections are structure.
Do you know exactly what is it ?
It's a kind of "sub content type", a set of fields which are connected directly to a node type, but which hasn't any specific existence.
It's not easy to explain with a simple sentence.
Comment #8
bailey86 commentedHiya,
I have looked at them - I'm not sure but I still think this is more structure.
For example - say you have two sites - and both have the same content types set up - with the same field collections in the content types. Are you able to export nodes from one site and import them into the other site with this module?
I.e. - if the content types are the same - can DEI be used to export nodes from one site to another?
Comment #9
sebastien m. commentedIf you use the sample code I have provided to you, field_collection content can be export from the first site and imported to the second one.
However, the structure of field_collection and content type needs to be updated previously by another module like for example bulk export or something like.
Comment #10
bailey86 commentedSo - I take it that the code/patch is needed to export/import field_collection node data. I'll need to look into it to see if the code/patch can be added without affecting current content types - or whether the code should be used conditionally based on the presence/absence of the field_collection module.
If you could provide the code as a patch I'd certainly look at adding it in.
Thanks,
Kev
Comment #11
rooby commentedField collections are structure like content types are structure.
Field collection data is content like node data is content.
Really this module should be able to handle field collection data.
The usage rate of field collections is quite high and this module is currently useless for any site with field collections.
Comment #12
bailey86 commentedI'd like to get this added so I'm going to leave this issue open.
This is how the module works - this is to help in case anyone wants to help out with a patch.
When the module exports a node it does it like this.
* The node object is created from from the ID number using the API.
* Attached files/images are found using the API - the files are converted to character strings, built up as arrays and then attached to the node object as extra attributes.
* The node objects are then serialized, base64 encoded and sent out to the dataset file.
On import:
* The lines in the file are read.
* Each line is unbase64 encoded, deserialized and then the objects are recreated.
* The code then looks for files which have been attached to the node object and saves the files.
* The file ID numbers are then added to the node object as attached files.
* The node objects are then saved using the API.
I think what needs to be added is similar to how files are added. I.e. when a node object has been created the field collection data needs to be found (via the API?) and then this data needs to be added to the node object before the node object is exported. On import the process would be reversed.
I'm currently too busy to add it myself - but would look at any patches sent in. Also, sponsorship to add this functionality would be another way to get it added.
Comment #13
bailey86 commentedComment #14
ecvandenberg commentedWhat is the status for this issue? Seems that it is not yet implemented in the latest version 7.x-1.7 which is newer than the latest dev.
Comment #15
rooby commentedSomething funky going on with releases on this project then.
There is a commit from November in 7.x-1.x and if I download the dev version the latest commit is in there, but the date on that download still says September.
Maybe something to follow up in the drupal infrastructure issue queue unless the maintainer can work out what is going wrong with it.
Comment #16
ecvandenberg commentedI have just installed the 7.x-1.x-dev dated 2013-Sep-30 on a fresh Drupal 7.28 site. And to my humble opinion Field collection data is not supported. I tested this as follows:
Comment #17
Rhodungeon commentedI can confirm that actually field collection is not supported. With this feature, this module will be a must for any Drupal website.
Comment #18
bailey86 commentedHi,
Thanks for looking at this.
I'm currently on a contract role and so no spare time to look to implement this. If anyone is interested they could request to become a maintainer and I'll look to add them so they could implement field collection.
Cheers,
Kev
Comment #19
sumithb commentedHi,
Please add support for field collection as well. No other module is as simple as this module to migrate data.
Thanks
Sumith
Comment #20
baseconversion commentedI agree. I think we should help make this module more robust, as it is excellent.