Closed (fixed)
Project:
Insert
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2010 at 00:54 UTC
Updated:
13 Aug 2010 at 14:20 UTC
I have created a custom formatter with the following code:
<div class="image-with-caption">
<div class="image"><img src="[site-url]/[filefield-imagecache-square-thumbnail]" alt="[filefield-alt]" title="[filefield-title]" /></div>
<div class="caption-box"><span="caption"><a href="[site-url]/node/[node-nid]">Description: [field_image-filefield-description] Size: [field_image-filefield-filesize_formatted]</a></span></div>
</div>
when using insert to insert an image with the above formatter, it will render into the following:
<div class="image-with-caption">
<div class="image"><img src="http://www.example.com:8080/sites/www.example.com/files/imagecache/square-thumbnail/Albert_Einstein_Head_Cleaned_N_Cropped_1.jpg" alt="fdfdafasdfdasf" title="fdfasdfasf" /></div>
<div class="caption-box"><span="caption"><a href="http://www.example.com:8080/node/">Description: [field_image-filefield-description] Size: [field_image-filefield-filesize_formatted]</a></span></div>
</div>
The code changes some of the tokens, but not all. I have inserted the same code through linodef and it is able to format the above two missing tokens correctly. Though it has a similar problem with the alt and title tokens.
Comments
Comment #1
quicksketchThis feature is impossible to implement because the tokens that are supposed to be inserted may not have been filled out yet. For example, how would the [node-nid] token be filled out when inserting into the body when the node has not yet been saved (and therefor given a NID)? If this even were possible, it would not be responsibility of Insert module to fill or replace these tokens before nodes are saved.
Comment #2
pkej commentedGood point.
I guess things like nid might work when the node is being edited.
As for the missing description I think it is because I used field_image-filefield-description instead of filefield-description. I had a similar problem with linodef and tried out different tokens and forgot to reset to the ones I think are the most "natural" to use.
Thanks for the feedback.
Comment #3
quicksketchAh, cool. Glad to hear that filefield tokens are working. Any user-tokens or global-tokens I think should work okay also.