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.
It should appear in the docs.php at least and have more mention in the api*html advanced help.
Comment | File | Size | Author |
---|---|---|---|
#21 | views-386186-21.patch | 811 bytes | tim.plunkett |
#18 | views-386186-18.patch | 686 bytes | tim.plunkett |
#17 | 386186.patch | 433 bytes | dawehner |
#3 | hook_views_data_alter_docs.patch | 1.43 KB | dawehner |
#2 | hook_views_data_alter_docs.patch | 0 bytes | dawehner |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedStill outstanding AFAICT - http://views.doc.logrus.com/
Comment #2
dawehnerHere is a basic first version.
Comment #3
dawehnerbut this time.
Comment #4
webchickI got clued into this hook from #372994: Ability to INNER JOIN to node for a specific field and went searching for docs and found this post.
Things I was looking for when looking for this documentation:
1. What's in that $data array so I don't have to print_r() it to find out?
2. When does this hook fire?
3. Why should I generally use it?
4. (my specific question) How can I change a join type?
I don't really know that any of those questions were answered by the current documentation.
In the examples, it would be nice to use something a bit more "real world" to give people a clue on what to do with this hook. If I end up figuring this out at all, I'll post back with an alternative patch, but please don't wait for me. ;)
Comment #5
newalexandria CreditAttribution: newalexandria commented'Riding a bit sidecar' to @webchick, I don't have a huge demand for making INNER JOINs on a specific field due to the low priority of my current task – but if I could do it, it might help the way I do many other things. If anyone can post answers to her 4 questions above, that would be very helpful
Comment #6
joachim CreditAttribution: joachim commentedA few answers:
> 3. Why should I generally use it?
If another module has defined the table and you want to add a field.
Eg, your module provides a snazzy field on users. But {users} is already defined by Views core on behalf of user module. So you can't define your field in hook_views_data, you have to use this hook and add to the existing user key.
> 1. What's in that $data array so I don't have to print_r() it to find out?
Whatever modules put into it in hook_views_data. Same structure.
Comment #7
gdoteof CreditAttribution: gdoteof commentedsubscribing
Comment #8
whiklojI am wondering if anyone can explain why using an else if
doesn't work, but if I separate it into 2 ifs...
If works perfectly?
I spent a couple hours debugging this before I tried this on a whim. Maybe I missed a piece of documentation?!
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedFrom the looks of it, you always want both clauses to run since you modify both the 'argument' and 'filter' values of the table; with your 'else' only one of them can run.
Comment #10
matt2000 CreditAttribution: matt2000 commentedWhile I agree that answers to webchick's questions would be nice enhancements, dereine's Patch in #3 provides the minimum needed to make use of this hook. There's no reason to wait for 'perfect' documentation when we've got 'good enough' sitting here waiting to be committed, and *nothing* in docs.php currently.
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedI agree. I've gone ahead and committed the minimal work so far, because having something is better than having nothing.
If someone would like to step up and expand this based upon the comments, I would really appreciate that. To that end, I am returning this to 'needs work' status in the hopes that someone will move on this.
Comment #12
esmerel CreditAttribution: esmerel commentedMoving this back to an active status; webchick's questions need answering, and nobody looks at stuff in 'needs work' :)
Comment #13
Ben Coleman CreditAttribution: Ben Coleman commentedLooks like this still isn't documented, almost a year later. Having this documented would have definitely saved me some time.
Comment #14
merlinofchaos CreditAttribution: merlinofchaos commentedSo this page doesn't exist?
http://api.drupal.org/api/views/views.api.php/function/hook_views_data_a...
Comment #15
joachim CreditAttribution: joachim commentedThe page http://api.drupal.org/api/views/views.api.php/function/hook_views_data_a... exists; the URL you gave doesn't ;)
It could still do with the $data array param being documented though.
Comment #16
merlinofchaos CreditAttribution: merlinofchaos commentedDocumenting the $data param there would be wasteful. It's the same as in hook_views_data -- at best it should have an @see.
Comment #17
dawehnerDoes this makes it a bit easier to understand?
Comment #18
tim.plunkettThe @see is redundant, I think this is enough.
Comment #19
tim.plunkettComment #20
merlinofchaos CreditAttribution: merlinofchaos commentedI don't think the @see is redundant actually. Lots of people seem not to understand what will be in that param.
Comment #21
tim.plunkettWell, then I think its just the URL itself. The @see is already two lines below it, and doxygen needs it to be there.
Comment #22
merlinofchaos CreditAttribution: merlinofchaos commentedAgree with RTBC now.
Comment #23
dawehnerIt's in! Thanks for the patch.