Needs review
Project:
Widgets
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 May 2012 at 22:46 UTC
Updated:
15 Jul 2012 at 10:30 UTC
Currently none of the node tokens in a widget template are expanded when rendered as part of a widget set in a block view because the data parameter of token_replace is not set in hook_block_view and corresponding theme functions. I'm attaching a simple fix which adds the "#token_data" parameter to the widgets_set_view theme function and adds the node object to the data array if the block is being viewed on a node page. This allows all node tokens (e.g. [node:nid], [node:url] etc.) to be used in widgets intended to be displayed in blocks on node pages.
This patch seems to be working for me on 7.x-1.0-beta5, though I haven't tested it on dev.
| Comment | File | Size | Author |
|---|---|---|---|
| block_node_token_support.patch | 1.01 KB | M. George Hansen |
Comments
Comment #1
grahamshepherd commentedI have the same problem but the proposed patch doesn't work for me.
I have created a widget definition to share to Yammer which looks like this:
I have plugged it into a share block but the resulting link is just:
Yammer literally takes "[node:url]" but not my node url.
Comment #2
grahamshepherd commentedWell. Something strange here. The patch works intermittently. Clear the caches and it doesn't work. Allow the caches to fill and it does.
I'm a dummy. What's going on?