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.
When creating a node-based view, I see how to develop a relationship with the root book node and fields to create a change history log. Unfortunately, only node revision log messages for each currently published node revision within the book is displayed.
When creating a node revision-based view, I see all node revision log messages; however, I cannot easily filter these down to nodes within a single book without the node-book relationship.
Am I missing something? Thanks!
Comment | File | Size | Author |
---|---|---|---|
#10 | 368687-node-node_revision-relationship.patch | 510 bytes | dawehner |
#8 | 368687-node-node_revision-relationship.patch | 456 bytes | dawehner |
#5 | node_revision relationship options.GIF | 8.32 KB | stacysimpson |
Comments
Comment #1
stacysimpson CreditAttribution: stacysimpson commentedAnybody have suggestions for how to create a relationship between the node revisions table and book table?
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedIn theory you would create the node_revision->node relationship which would then open up all the node information as well.
Comment #3
stacysimpson CreditAttribution: stacysimpson commentedThanks for the input. The node_revision->node relationship is available. Here is the query that I need to generate:
Basically, I need the following:
1. Ability to join the node_revisions table with the node table and the book table.
2. Ability to pass in the root book node id as a parameter
3. Additional revision version filter for filtering out revision log messages for revisions that haven't been published yet.
From the views source code documentation, "The base relationship handler can only handle a single join. Some relationships are more complex and might require chains of joins; for those, you must utilize a custom relationship handler." It seems that I would need to create a custom relationship handler to join the node_revisions table with both the node table and book table.
Does anyone know if that is the correct direction? Any other thoughts or suggestion for how to approach the custom relationship handler? Many thanks!
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedOnce you add the node_revision -> node relationship, node fields (Including book fields) should automatically become available for use with that relationship, so yes, that should be all you need to create this query.
Comment #5
stacysimpson CreditAttribution: stacysimpson commentedI don't see a method in 6.x 2.3 to create a node_revision -> node relationship. It seems to be one of what the documentation calls an implicit relationship.
Comment #6
stacysimpson CreditAttribution: stacysimpson commentedmerlinofchaos (or others), appreciate the feedback, but wondering if you have any other thoughts. Again, the book-related information is not available when the 'node revision' base is chosen in Views. When choosing 'node' as the base, they work. Thanks again!
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedI think this is an unfortunate side effect of having an implicit relationship rather than explicit, which means you can't do this without a relationship which does not yet exist. :/
That makes this a feature request.
Comment #8
dawehnerSo here is one
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commented'base field' should not be 'node'
The labelling on this field needs work. I couldn't find it at first. Relationships usually need separate title and help lines.
Comment #10
dawehnerHere is a from my perspective better help text
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedChanged wording a little more and applied to all branches.