9

I have a content type (Question of the Week)... with a Date field (Used for "Publish Date". Questions won't be published until that date).

I am trying to custom format the Title for it without changing the default (Long, Medium, Short) date formats.

For "Pattern for the title"...
If I [node:field-jcqotw-date:custom:l] it shows the day (ex: Sunday).
If I [node:field-jcqotw-date:custom:lF] it shows the dayMonth, no space (ex: SundayJune).
If I [node:field-jcqotw-date:custom:l F] it shows "[node:field-jcqotw-date:custom:l F]" (ex: SundayJune).
If I [node:field-jcqotw-date:custom:l F] it shows "Sunday June" (ex: SundayJune).

I've tried "l F", 'l F', l\ F,   (non breaking space),   (Space), etc... Nothing I do seems to let "Custom" use a space.

Edit: After some research... it seems to be an Entity Tokens + CCK Date Field issue... I'll have to put an issue up in those places.

Why can't I use a space in the "Custom format"?

Also... I've created a "Date Type" simply called "myDate" => 'l F j, Y' ('Sunday June 5, 2011'). Is there a way to get Token to show that format? Long, medium, raw, short... "myDate"...

Edit: Updated Title and Question to be more correct. The problem has something to do with Entity API, Context, Date Field

5

In this commit to Date module, token integration was removed, because field tokens aren't working yet.

The error you got it reproducible with an older copy of Date module, but doesn't seem to be related at all to Automatic Nodetitles, just Date/Token.

I would wait until the above Token issue and the Date issue Re-Add Field Token Support are committed.

  • I think it has to do with Entity API/Entity Tokens + Date module. From a little research it seems as if the CCK fields are available after enabling the "Entity Tokens" addon. I'll have to put an issue up there, although I've just used .'s instead of spaces as a stop-gap. – WernerCD Jun 10 '11 at 2:26
  • The Entity API contrib module may or may not provide it's own tokens, but those aren't the ones that will end up being fully supported by the Token module. Also, CCK does not exist in D7, the part of it that is in core is the Field API. – tim.plunkett Jun 10 '11 at 3:22
  • CCK, as a module, does exist in 7 (provides "extra" stuff...). The tokens I'm using, afaik, are from a combination of Entity API, Entity Tokens, Tokens, Date API (More or less). Must just be something buggish in the "custom" part that isn't allowing me to use spaces. – WernerCD Jun 16 '11 at 17:46
2

This is actually a core bug that spaces cannot be used in 'dynamic' tokens. You may want to try the patches available in http://drupal.org/node/1035292.

0

You can also insert the token multiple times, each time inserting only one part of your date format. The spaces between are then correctly interpreted.

<div class="posted-on">%node:created:custom:M %node:created:custom:j, %node:created:custom:Y</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.