Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Please consider this patch for token support in scheduler. It provides the following:
Comment | File | Size | Author |
---|---|---|---|
#19 | 960030-scheduler-d7tokens.patch | 3.51 KB | Dave Reid |
#5 | scheduler-tokens.patch | 1.25 KB | sirkitree |
#4 | scheduler-tokens.patch | 1.23 KB | sirkitree |
#1 | scheduler-tokens.patch | 1.26 KB | sirkitree |
scheduler-tokens.patch | 1.25 KB | sirkitree | |
Comments
Comment #1
sirkitree CreditAttribution: sirkitree commentedUpdate to the patch. The method I'm using in this patch to generate the values for the various date formats was missing the prefix.
Comment #2
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedI 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?
Comment #3
Dave ReidYou're duplicating the raw timestamp tokens. The date helper function already gives you prefix-raw as evidenced in your screenshot.
Comment #4
sirkitree CreditAttribution: sirkitree commented@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.
Comment #5
sirkitree CreditAttribution: sirkitree commentedneed to declare $tokens as an array before trying to use +=
Comment #6
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedSo you can use the values of those tokens in other modules? Sounds great.
Comment #7
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedI 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.
Comment #8
robhamm CreditAttribution: robhamm commentedShould 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.
;-)
Comment #9
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedI 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.
Comment #10
Dave ReidTokens 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.
Comment #11
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedThanks, Dave. Since you seem to know a bit or two about the token module, can you help me out with #7?
Comment #12
Dave ReidOh absolutely I'd recommend something longer like (un)publish-on- or even scheduler-(un)publish-
Comment #13
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedThanks a lot!
Comment #14
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedOK, here is a new patch. I changed the token prefixes and also the
scheduler_token_list()
.Comment #15
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedhttp://drupal.org/cvs?commit=457882
Comment #17
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedComment #18
sillygwailoComment #19
Dave ReidComment #20
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedOh, great, thank you. I figured out scheduler_token_info() myself but scheduler_tokens() gave me some headaches...
Comment #21
Eric-Alexander Schaefer CreditAttribution: Eric-Alexander Schaefer commentedWorks: http://drupal.org/cvs?commit=492552
Thanks a lot.