Hi,
I might be missing something, but it seems to me that _hook_webform2pdf_list_template_vars and _hook_webform2pdf_list_template_vars aren't implemented in a usable way :
they are both called within a "default" switch case statement that won't get called. Also it seems they are called through an call_user_func, that does not get assigned.
Attached patch tries to correct this behaviour.
Sorry if I'm missing something obvious there.
Pascal
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform2pdf_module_tokens.patch | 1.53 KB | bellesmanieres |
Comments
Comment #1
shafter commentedThese hooks are need to be implemented, when you are using a component, which is not included in webform module. The webform2pdf module doesn't support these components. When you're using the default webform module, these won't be called.
If you want to edit a token variable, use
hook_webform2pdf_tokens_alter($tokens, $node, $submission)function.By the way, I can't find the patch you mentioned here, where can I find it?
Comment #2
bellesmanieres commentedHi,
Attached the patch, but don't think it is needed if these functions aren't called on purpose. Anyway, seems hook_webform2pdf_tokens_alter() will do the trick in almost anycase.
Thanks.
Comment #3
shafter commentedWe doesn't want the module to enable this functionality. Can you tell, what do you need it for?
Comment #4
shafter commentedWe doesn't want the module to enable this functionality. Closing.
Comment #5
shafter commentedComment #6
MiniMax commentedThe patch in #2 is correct, the description is just a little bit confusing.
I have an own webform component that implements the two hooks:
_hook_webform2pdf_list_template_vars
_hook_webform2pdf_get_template_vars
Both function retrieving the tokens array by value. Adding values to the tokens array has no effect to the calling function
==> it is impossible to extend the tokens
==> the hooks are useless
With the patch the extended array can be returned back which works fine.
However, the patch is not perfect. In general, these hooks should only extend the tokens. But with this patch they are able to remove already assigned values. I think it would be sufficient to remove the tokens parameter from the hooks and merge the returning values.
Comment #7
mr.york commented