Please consider this patch for token support in scheduler. It provides the following:

Work Wizard | Adoolia

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sirkitree’s picture

Status: Active » Needs review
FileSize
1.26 KB

Update to the patch. The method I'm using in this patch to generate the values for the various date formats was missing the prefix.

Eric-Alexander Schaefer’s picture

I am not terribly good acquainted with the token module. I only know those tokens from the Pathauto module. What could you do with those scheduler tokens? What's your use case?

Dave Reid’s picture

Status: Needs review » Needs work

You're duplicating the raw timestamp tokens. The date helper function already gives you prefix-raw as evidenced in your screenshot.

sirkitree’s picture

Status: Needs work » Needs review
FileSize
1.23 KB

@Eric - my use case happens to be where I am providing some messages for confirmation forms that are based around submitting the content type that is using scheduler. Within these custom messages I wanted to provide tokens for the un/pub data so that when the confirmation comes up it can say something like, "Your content will go live on 'such and such' scheduled date." So really the tokens are being used by a different module than scheduler, but I thought it appropriate to have the tokens for scheduler, within scheduler, rather than my custom module.

@Dave - right you are! Totally missed that. Patch revised.

sirkitree’s picture

FileSize
1.25 KB

need to declare $tokens as an array before trying to use +=

Eric-Alexander Schaefer’s picture

So you can use the values of those tokens in other modules? Sounds great.

Eric-Alexander Schaefer’s picture

I can't test this, but it does not seem to break anything.

Is there any reason why we couldn't use a longer prefix like "publish-" and "unpublish-" or even "publish_on-" and "unpublish_on-"? I would like prevent any name clashes. Also if we extend scheduler with more schedules actions it would be good to have some kind of name scheme.

robhamm’s picture

Should I apply this patch to 6.x dev before sivaji's patch from http://drupal.org/node/598994 to try to beat Scheduler into submission for 7.x? Or is that a Bad Idea that may induce baby-eating behavior?

I mean, yeah... Test site, sure, but I figure if it's something you already know I shouldn't attempt, I can put down the sharp objects now before I hurt myself.
;-)

Eric-Alexander Schaefer’s picture

I don't know. If tokens are defined in D7 the same way as in D6 you could patch for D7 and just add the two functions in the tokens patch manually.

Dave Reid’s picture

Tokens are defined differently in D7. Once the D7 port code is committed I can more than help with a patch to help add the token integration there.

Eric-Alexander Schaefer’s picture

Thanks, Dave. Since you seem to know a bit or two about the token module, can you help me out with #7?

Dave Reid’s picture

Oh absolutely I'd recommend something longer like (un)publish-on- or even scheduler-(un)publish-

Eric-Alexander Schaefer’s picture

Thanks a lot!

Eric-Alexander Schaefer’s picture

OK, here is a new patch. I changed the token prefixes and also the scheduler_token_list().

Eric-Alexander Schaefer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Eric-Alexander Schaefer’s picture

Status: Closed (fixed) » Patch (to be ported)
sillygwailo’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Dave Reid’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.51 KB
Eric-Alexander Schaefer’s picture

Oh, great, thank you. I figured out scheduler_token_info() myself but scheduler_tokens() gave me some headaches...

Eric-Alexander Schaefer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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