Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comments
Comment #1
IshaDakota CreditAttribution: IshaDakota commentedAlso, 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:
I guess this is a good workaround, but not as exportable.
Comment #2
Andre-Byou 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.