Closed (duplicate)
Project:
Date
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2012 at 16:02 UTC
Updated:
11 Feb 2014 at 11:21 UTC
Jump to comment: Most recent
The tokens created by Token module are not working for Date or other fields. But we had tokens created by the Entity Token module working at one point.
That got broken by a patch I committed before it was ready at #1266688: Support microdata in date fields. That patch is reverted but I'm still seeing problems. Not all my date fields seem to have tokens, only a few of them.
Not sure yet what the problem is.
Comments
Comment #1
karens commentedOK, Entity Tokens work fine, but only when you use the latest dev version of Entity. The patch to get this working went in last November, but there hasn't been a release since before it was added. So tokens won't work unless you have the dev version.
Comment #3
bcobin commentedSee http://drupal.org/node/1511830 - latest dev version of Entity API (4/23/12) doesn't fix the problem.
Comment #4
Taxoman commentedRe-opening per #3.
Comment #5
linneawilliams commentedLatest dev version of Entity and all most recent releases (as of today: 5/22/2012) of relevant modules have fixed this problem for me.
Comment #6
nickbits commentedI may be missing the point, but I have all the latest dev releases (entity, date, token, etc.) and I don't get all of the tokens working. One example:
meetings/[node:field-event-date:custom:Y]/[node:title]So question is is this fixed? Is it a date issue or are we still waiting for tokens (entity) to be fixed?
Comment #7
jeremymcminn commentedI would also like to know if this is working too
Comment #8
stevep commentedWorking for me, but it wasn't initially.
Until I noticed I had not enabled Entity Tokens module, then ran cron and flushed caches, then the second "Date & Time [node:field-datetime:?]" selection in the replacement patterns (URL aliases) was available.
Then my replacement event pattern "event/[node:field-datetime:value:custom:j]-[node:field-datetime:value:custom:M]-[node:field-datetime:value:custom:Y]/[node:title]" worked fine. (my "node: field-datetime" might be different for others. Depends what you label it).
After that I updated the url's for existing events, as you would expect -- all good.
update -- just noticed the error in nickbits query.
I used [node:field-datetime:value:custom:Y] with "value" included. Works fine.
Comment #9
tim.plunkettYes, using the dev versions and clearing the cache works just fine.
Comment #10
matmasr commentedstevep, tim.plunkett
Can you please let me know what exact versions of the DATE, ENTITY API and TOKEN you are using?
I am trying to create a custom formatter for a date field in my content type called "field_time" with an underscore. The date format for this field is ISO format. The Entity Token module shows me a token replacement called
I created at replacement token for my custom formatter as follows
However, when I try to test it I get the following error
I am using the following versions
DATE: 7.x-2.5
ENTITY API and ENTITY TOKEN: 7.x-1.0-rc3
TOKEN: 7.x-1.1
Thanks for your help.
Comment #11
matmasr commentedFollow up on the issue above. My date field is in ISO format. It is like that since I upgraded from D6 to D7.
Comment #12
nickbits commentedReply to #8, sorry that was a typo, on autopilot. I will try a fresh install of drupal and see if it works, seems it is working for others, so obviously something on my set-up.
Comment #13
nickbits commentedCan confirm it is working for me on a fresh install. Not sure what the issue was previously. Just for reference, working installation using:
Last 3 are the latest dev releases as of 3rd June 2012.
Thanks,
Nick
Comment #14
matmasr commentedDoes anyone know why I could be getting this error ?
I am using the following versions
DATE: 7.x-2.5
ENTITY API and ENTITY TOKEN: 7.x-1.0-rc3
TOKEN: 7.x-1.1
I am guessing it has to do with ISO date formats. When I created a new DATE field and applied my formatter with the following tokens it is working fine.
Thanks
Comment #15
bforchhammer commentedSorry for reopening, but I'm getting this error as well.
I have a date-field which allows multiple values. Verified this on a clean drupal install with latest version of drupal, and latest dev versions of date and entity.
Steps to reproduce:
field_multiple_dates[node:field-multiple-dates]tokenTokens results:
[node:field-multiple-dates]= "Property 0"[node:field-multiple-dates:value]=>Fatal error: Call to a member function value() on a non-object in \sites\all\modules\entity\entity_token.tokens.inc on line 297Comment #16
tim.plunkettPlease open a separate support request.
Comment #17
bforchhammer commented#1618200: Fix date tokens for multiple values (fatal php error)
Comment #18
kurtronaldmueller@gmail.com commentedhas anybody found a way to do this without a fresh install of Drupal? I have a site with a good amount of content that makes migrating a pain... perhaps somebody could point me to a module that would make it easy to migrate? Would backup & migrate and the migrate module take care of this? Please let me know.
Kurt
Comment #19
colanI was able to get it working without a fresh installation. It was necessary to drop the ":value" part of the string. Here's an example:
[node:field-date-effective:custom:Y-m-d\TH:iP]Comment #20
nodecode commentedSo was this committed to the latest release? I'm getting this same error using 7.x-2.6 and 7.x-dev even after clearing all caches etc. It's not working for me, and furthermore I contend that a fresh Drupal install is NOT a solution.
That said, this bug may have roots not in the Date API but in the Entity API module as pointed out in #17 So I believe this issue may not be fixed until #1621084: Support list<struct> type tokens is fixed. I'll be watching that issue.
Comment #21
kclarkson commentedSo with the patch #1621084 applied to the Entity API will I be able to use the custom token's of [node:field-time:value:custom:Y] ?
Thanks,
Comment #22
bomarmonk commentedI'm still getting the error where date tokens (for entities/ date fields) returns a date earlier than the one entered. For example, I put in [node:field-date-issue-year:custom:Y], and even though the field accurately reflects the year entered (showing 2013), the date token subtracts one year (showing 2012).
I'm using Token 7.x-1.4, Date 7.x-2.6+2-dev, Automatic Nodetitles 7.x-1.0, and Drupal 7.18. Is there a way to get the date entity token to return the right date?
I'm starting a new issue, since I'm not sure my problem is the same as the one being addressed here.
Comment #23
bomarmonk commentedAlso note that I'm using Entity API version 7.x-1.0 (released December 25 2012)
Comment #24
bcobin commented@kclarkson - #21
I have custom dates working with the dev version of Entity API (7.x-1.0-rc3+11-dev) and the latest production release of Custom Formatters. No patching required. Just make sure to clear caches, I guess. I've run into another issue with Entity API where the dev version fixed things - for @bomarmonk, I'd suggest using the latest dev and see what happens.
Comment #25
rockland commentedSubscribing
Comment #26
kclarkson commented@bcobin
Thanks for the suggestion
Comment #27
bcobin commentedThis is broken - again - with latest dev of Entity. I note discussion of microdata in other threads, along with patches, but am at a loss here.
Custom formats are available for current date field, but not for custom fields - any clarification as to what the issue is would be greatly appreciated...
Comment #28
kclarkson commented@bcobin
doesn't look like your solution is working either. I am trying to get a url based of off a node date field. So I have a start and an end date. I would like the url alias to be 2013/03-01/node title
Comment #29
klonos...coming from #1058856: Entity tokens not created for multi-value fields / #1440928: Entity tokens for multi-value fields produce a fatal error
Comment #30
vijaycs85Anyone still facing this problem?
Comment #31
vijaycs85#15 is #1618200: Fix date tokens for multiple values (fatal php error)
#27 and #28 are showing that this is more of entity than date.
Closing this issue now.
Comment #32
vijaycs85