Closed (outdated)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Dec 2010 at 17:57 UTC
Updated:
24 Apr 2024 at 18:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sirkitree commentedHrm, upon closer inspection it seems this menu item is actually part of date_api.module, not core...
Comment #2
sirkitree commented... Which only operates on 'field' types, not 'node' which is what I was hoping for...
Wondering if it would be acceptable to just module_exists('date_api') and still include this within token_get_date_token_info/values
Comment #3
sirkitree commented[edit] double post
Comment #4
sirkitree commentedHere's a patch - this successfully pulls in any custom date formats you create through date_api which any module utilizing token_get_date_token_info/values can then have tokens for...
Custom date formats:

Corresponding tokens:

Example of Scheduler which utilizes token_get_date_token_info/values for it's publishing tokens:

And a final end result where the new custom 'longer' token is being rendered:

Comment #5
dave reidI'm worried about this slowing down token. We're already generating every single token possible. Plus this definitely has to re-roll against the lastest 6.x-1.x code because there have been a lot of recent changes to date token generation (i.e. we have our own token_format_date() that should be used). Also, doesn't the 'short' token conflict with the 'small' token? Also the descriptions need to re-use the $description parameter in token_get_date_token_info().
Comment #6
sirkitree commentedI know what you mean about slowing token down - and ideally this would go into date module, except there is no way presently to extend these functions. Date could provide these in it's hook_token_info, but any module using token_get_date_token_info/value directly will then not benefit from custom formats.
One possibility would be to create a small submodule to encapsulate this functionality, token_date or something, but would still require a hook within token_get_date_token_info/value to allow extension. This would have the effect that a use would need to enable the submodule and therefor (hopefully) be aware that they are adding processing of a significant nature - but that seems a bit overkill for the amount of overhead that module_exists() might create.
In anycase, here is an updated patch against 6.x-1.x
Results:

Also - now removes the date format small if date_api enabled.
Comment #7
dave reidThis should just be adding the formats into the array, not actually doing replacement as this will only be executed once per request.
Powered by Dreditor.
Comment #8
dave reidAdding new release blocker tag.
Comment #9
dave reidI reverse myself on the blocker tag.
Comment #10
bluegeek9 commented