Is it possible to make image styles available to the tokens for the message entity?

Actually, I know that it is possible, because Drupal Commons does it here in the commons_activity_streams module:

    "message_text" : { "und" : [
          "value" : "[message:user:picture:35x35]",
          "format" : "filtered_html",
          "safe_value" : "[message:user:picture:35x35]"
          "value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E created \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title]\\u003C\\/a\\u003E",
          "format" : "full_html",
          "safe_value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E created \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title]\\u003C\\/a\\u003E"

I can't seem figure out how to make that token available though.

Any thoughts?


IshaDakota’s picture

Also, I do know that you can hard code the path to the image style and use the token for the user picture file name as such:

<a href="[message:user:url]"><img src="/sites/default/files/styles/user_thumbnail/public/pictures/[message:user:picture:name]" /></a>

I guess this is a good workaround, but not as exportable.

Andre-B’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

you can use the field token of that image and have a custom display mode for 'token' enabled, there you will be able to select how to render each field for the token view mode. This might help for the start, but if you need different settings for multiple messages you will have to create a custom token taking care of that.