Add a component to export books and their pages. Ideally it would support the following usage:
- Export whole books - select a book and all nodes and book structure are exported.
- Export selected book pages. This would allow different features to contribute pages to a common book. E.g. a user manual book with pages supplied by enabled features.
It looks like this could be achieved fairly easily by adding book structure information to node exports...
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | uuid_features-1048470-4.patch | 8.83 KB | chaps2 |
| #3 | uuid_features-1048470-3.patch | 9.26 KB | chaps2 |
| #1 | uuid_features-1048470.patch | 9.22 KB | chaps2 |
Comments
Comment #1
chaps2 commentedHere's a patch.
The trickiest part was dealing with the fact that nodes are exported (and therefore loaded) in an arbitrary order. This means that the book hierarchy can only be reliably created after all the book nodes have been loaded. For this I needed a new hook in uuid_node_features_rebuild() which is called after all nodes have been rebuilt.
The patch supports both usages listed above although you'll need the patch in comment #1 of #935726: Feature conflict: unnecessary nodes, node types, terms, vocabularies, and files in order to export selected book pages and avoid a conflict on node type.
Comment #2
chaps2 commentedComment #3
chaps2 commentedFound a bug - this fixes it.
Comment #4
chaps2 commentedOne more patch... this time I've moved the new hook to it's own issue - #1049760: New hook invoked after all nodes have been rebuilt. I made another patch that invokes it so it made sense to give it it's own issue and patch.
So, to use this latest patch you must also apply the patch in comment #1 of #1049760: New hook invoked after all nodes have been rebuilt.
Comment #5
mlncn commentedSubscribe... currently i'm doing this with update hooks in a special content feature run (by script) after all the other features are set up, but i wanted to say i had this use case.
Comment #6
scottrigby@chaps2 this should probably enable the book module as a dependency, in uuid_book_features_export():
Comment #7
vectoroc commentedperhaps you know that the book module contains next code
it produces many php warnings like
query: INSERT INTO uuid_node_revisions (vid, uuid) VALUES (44, 'cd9cd0cc-cf19-11e0-a511-fefd6d4ac813') in ...I see 2 workarounds:
to call book_nodeapi directly (I know it's a hack)on rebuild stage it will call book's hook_nodeapi and book will override revision propertyActually this patch does not recreate all book structure (probably something wrong with sorting)Comment #8
vectoroc commentednode_get_by_uuiddoes not work in some casesI've replaced it with
node_load(uuid_get_serial_id('node', 'nid', $uuid));and now it worksComment #9
vectoroc commentedrelated issue #1261196: node_get_by_uuid should not pass query through db_rewrite_sql
Comment #10
vectoroc commentedAlso I've found that it's important to set
$node->book['module'] = 'book';Otherwise book menu link wont work correct
Comment #11
scottrigby@vectoroc do you want to re-roll a patch for this issue, to go along with #1261196-5: node_get_by_uuid should not pass query through db_rewrite_sql?
Also, are you using one of the patches from #1049760: New hook invoked after all nodes have been rebuilt?
Comment #12
vectoroc commentedMay be later.
I use #1049760: New hook invoked after all nodes have been rebuilt #1 patch
There is my patched version of uuid modules
Comment #13
oleksa commentedIs there an equivalent for D7? I am looking into using a Drupal book content type to maintain software help docs for an open source project, so drupal could be leveraged to enable the collaborative work on those docs, which then could be exported to static html to be loaded into the help browser in the software.
Comment #15
das-peter commentedWoohoo, I've just re-rolled and adjusted the patch to work with the 7.x-1.x version.
Tests were successful and thus it's committed :)
Thank you all for working on this.