Hi,
i am writing a tutorial for theming the autocomplete output for both finder 1.x and 2.x.
So i did a clean install to make sure i get everything right. As a matter of fact, i can´t use node_load($option->nid); in the theme_finder_autocomplete_suggestion. This is very strange, $option->field_name is there. I tried to dsm() $option without luck.
Anyone with the same problem ?
Comments
Comment #1
danielb commentedCan you double check which version you have installed?
Comment #2
john_the_noob commentedHi,
it´s Drupal 6.22 and Finder 6.x-1.17.
http://www.johnstestserver.de/d6f1/finder/cool_finder/
The ouput is 4 lines:
If i use $node = node_load(7); i get the correct results for node/7. So there lies the problem. I tried to switch back to a working 1.10 from another installation but no luck. Very weird.
Comment #3
john_the_noob commentedOk, i now managed to give out $option, look like:
finder_field_1 (String, 30 characters ) first test page 1 first page 1
field_name (String, 14 characters ) finder_field_1
display_field (String, 14 characters ) finder_field_1
-> Still live here: http://www.johnstestserver.de/d6f1/finder/cool_finder
Comment #4
danielb commentedI don't seem to have any troubles with
$option->nid(or more correctly$option->{$option->base_field})Try dpm() - you should see the output after a page refresh. See my tips here; http://drupal.org/node/1342234
I get some output like this:
If you continue to have trouble with this, post an export of your finder. Perhaps there is a bug specific to your configuration?
Comment #5
danielb commentedComment #6
danielb commentedComment #8
LGLC commentedWasn't sure whether to open a new issue or not as the description would have been almost identical - apologies if I should have.
I'm trying to theme the autocomplete suggestions and have realised that
$optiondoesn't seem to contain any nid information (for a node finder), meaning I can't do anode_load.Here's my theme function:
When I refresh the page after using the autocomplete, Devel outputs the following information about
option:(Object) stdClass
finder_field_1_matched (String, 1 characters ) 1
finder_field_1 (String, 10 characters ) test title
field_name (String, 14 characters ) finder_field_1
display_field (String, 19 characters ) finder_field_1_safe
finder_field_1_safe (String, 10 characters ) test title
Any pointers on how I could grab the node and therefore the other fields would be amazing.
Thanks!
Comment #9
LGLC commentedOops, should probably have changed it to a bug report considering the theming guide at http://drupal.org/node/1342234 no longer works.
Comment #10
danielb commented2nd paragraph of the theming guide states 'views finder'... you said 'node finder'....
Comment #11
LGLC commentedAh thank you very much for pointing that out, danielb! It all works perfectly with a views finder. I've updated the theming guide to make this clearer in case other people make the same mistake as me.