Per original discussion with Deciphered, make the module support nid, title, timestamp tokens.

The functionality that sets ImageField Tokens apart is that it allows for Node tokens, which require the tokens to be processed after the node has been processed as certain Node tokens aren't available others (NID, Title, etc, can't be know until the Node is saved).

Current code runs token_replace() during node_save() in hook_field_attach_presave(). The hook_filefield_paths_process_file() in the D7 filefield_paths.module is run during hook_node_update(), so you've got to call field_attach_update() twice.

Functionality could be implemented using hook_field_storage_pre_insert() and hook_field_storage_pre_update(); the functions run after drupal_write_record('node', $node); and drupal_write_record('node', $node, 'nid'); but before the field data is saved. Neither or implement hook_field_storage_pre_insert/update(). Reference:


colan’s picture

millionleaves’s picture

Issue summary: View changes
Status: Active » Fixed

Marking this as fixed. I have just tested on a clean install and there are no problems rendering NID, node title and various timestamp tokens in the ALT text of my images.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.