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

CommentFileSizeAuthor
#2 webform2pdf_module_tokens.patch1.53 KBbellesmanieres

Comments

shafter’s picture

These 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?

bellesmanieres’s picture

StatusFileSize
new1.53 KB

Hi,
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.

shafter’s picture

We doesn't want the module to enable this functionality. Can you tell, what do you need it for?

shafter’s picture

Status: Active » Closed (won't fix)

We doesn't want the module to enable this functionality. Closing.

shafter’s picture

Status: Closed (won't fix) » Closed (fixed)
MiniMax’s picture

Version: 6.x-1.1 » 6.x-2.3
Status: Closed (fixed) » Active

The 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.

mr.york’s picture

Status: Active » Closed (works as designed)