Hi, thanks for this module. It has been very important in a CRM/intra project I built recently.
I noticed that when showing search results of node attachments (using the helper functions "search_files" and "filefield"), the links always point to the actual file and not the node.
Can't we have both? It would be very important for my project.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | search-result.tpl_.php_.txt | 2.67 KB | bibo |
| #3 | 816770.patch | 780 bytes | jhodgdon |
Comments
Comment #1
jhodgdonThat does seem like a reasonable thing to add... I'm in development mode now for the next 6.x version of Search by Page, so I'll figure out a way to put this in... Though I'm not sure exactly how, since the search result information structure comes from the Search module and is fairly standardized.
Hmm... I think what I will do is add a 'related_node' component to the search information returned by the Attachments module, and then in your theme you can do whatever you want with that.
So it would show up in the search-result.tpl.php template (which your theme can override) as an additional component $info_split['related_node'], which you could then display however you wanted to.
http://api.drupal.org/api/drupal/modules--search--search-result.tpl.php/6 for more documentation on the template file.
Comment #2
bibo commentedWow, I couldn't hope for more. Your approach sounds perfect :)
Comment #3
jhodgdonSlight change. It doesn't end up in $info_split['related_node'] but in $result['related_node'].
Here's a patch that should add it there. Can you see if it serves your purpose?
Comment #4
bibo commentedPatch works just as expected :).
In case others want to do this too, here is how I themed the search-result.tpl.php-file:
In other words, I just added these 3 lines:
Since I'm appending the text to the already included $info-var, even these few lines of code could live somewhere else, like a preprocess function in template.php.
Works great for my needs.
Thank you jhodgdon!
EDIT: switched to < code > tags to avoid filter mess.
Comment #5
jhodgdonThanks for testing! I've added that patch (plus an addition to the README file) to the 6.x-dev release, and I expect to have a new version of Search by Page 6.x out in the next week or so.
So this is fixed in 6.x-dev now. It also needs to be ported to the 7.x-dev version of Search by Page.
One note: due to the quirks of formatting in issue comments, your solution for the template file didn't come through very well. You might consider adding the whole file as an attachment, although your note at the end about the 3 (well, actually 4) added lines is clear enough.
Comment #6
bibo commentedOkay, I'll add the template file as an attachment here :)
Comment #7
jhodgdonThis patch has also been committed to the Drupal 7 development version of SBP Attachments.