So the word is that the Token Module has been incorporated into core. That's great, but...

  1. There doesn't appear to be a Token feature in the modules list to either enable or disable; so I assume it's always turned on? I don't know...
  2. Whereas in D7 there were numerous "helper functions" wherein I could look up the right token to use in a given field or instance, in Backdrop these are often nonexistent. Is there a helper module for this?

As a kind of half-coder/half-builder, I feel a little left out here. What happened to the fairly excellent Token Assistance that was there in D7? Don't get me wrong: I'm a die-hard Backdrop enthusiast, but there seems to be a dropping of the ball here...  Where can I get the Token information that I need? Where are tokens thoroughly documented? Please help. My current situation: I want to pass a parameter (an argument) to a view in the Views Field. I have child nodes containing node references to the parent node in which I have a views field, but the UI in the field setup says "Enable the Token module to see a complete list of tokens that may be used as arguments." —Okay, I assume this verbiage is a carryover from a D7 version of the Views Field module, or something. But of course there is no Token module, so I am at a loss as to how to format my entry in order to pass the NID of this parent node to the View. I've tried  %nid and [nid]... No joy.

Any help is much appreciated. Thanks in advance.   —Eric

PS: the links provided at https://api.backdropcms.org/api/backdrop/modules%21examples%21token_example%21token_example.module/group/token_example/1 appear to be broken (no longer existent) so some editing in that documentation might be in order...

Accepted answer

@TommyWillB 

The screen that @klonos is looking at can be found in BackdropCMS out of the box (no modules to enable or settings to configure). Here are my steps:

1) I went to https://backdropcms.org/demo and spun up a fresh site

2) I went to the configure settings for the Page content type: admin/structure/types/manage/page

3) Near the bottom, I clicked on the "URL Alias Pattern" tab and to the right I was able to "Browse Available Tokens." screenshot of page content type settings form

Another place you can find tokens right out of the box, with Backdrop CMS core is in the "Accounts emails" settings - admin/config/people/emails

screenshot of user email page.

If you are looking for tokens somewhere specific and can't find them, let us know. 

Comments

Okay...!

I discovered the answer for my immediate situation. The answer is this:

[node:nid]

This did the trick for my immediate situation. Nonetheless, the overall gist of my request remains... Is there a central clearinghouse of tokens, or must we always seek, search, and find the answer by trial and error? I'm guessing that the info exists somewhere, but perhaps it needs to be finally put into a central database...

But since I don't really know how the token mechanism works, I wonder if tokens are generated by a central authority, or if modules are able to "make them up on the fly"... In the latter case, then centralized documentation of them will be nearly impossible...

I remain curious.

Cheers, —Eric

klonos's picture

Sorry for the late response on this one ericfoy, and thanks for taking the time to follow up with a comment to explain what the solution was in your case.

Yes, the Token module has been merged into the System module (and other respective modules) in Backdrop core version 1.1.0, back in May 2015; so it is "always on", and there's no separate module for it. For details, see this issue in GitHub, and the respective pull request that was merged as part of that issue.

I am not familiar with this "Token Assistance" that you are referring to; is that a contrib module? I've tried looking it up, but my google skills are failing me today 😅. Can you please provide more info and/or links? ...the only thing that I can imagine you may be referring to is the "Token Browser" which is available in Backdrop core, for example:

...perhaps this token browser has not been enabled for the field you are using(?).

Also, you are referring to the Views Field module (that being https://www.drupal.org/project/views_field, right?) but I was not able to find its port for Backdrop in https://github.com/backdrop-contrib (if it has been ported, and I'm just not able to find it, I'll be really disappointed in myself - I must be getting old and my searching skills rusty 😅). Are you perhaps using the D7 module as is? If so, then the reference to the separate Token module is expected, as it was not included in Drupal core as is the case for Backdrop.

I've created https://github.com/backdrop/backdrop-issues/issues/4490 so to keep on our radar to fix the "placeholder" links in our API documentation. Thanks for bringing that to our attention 🙏

TommyWillB's picture

I don't understand your answer.

1) I'm on Backdrop 1.18.1

2) I'm looking at the same screen as you but do not see that Available Tokens thing

3) How did you get that tab called URL Alias Pattern?

4) I don't see any core or installable modules that will expose that Available Tokens

 

Could you please update your answer to clearly explain how we all can see the list of available tokens?

 

Thanks,

Tom Baker

Spatial Path

@TommyWillB 

The screen that @klonos is looking at can be found in BackdropCMS out of the box (no modules to enable or settings to configure). Here are my steps:

1) I went to https://backdropcms.org/demo and spun up a fresh site

2) I went to the configure settings for the Page content type: admin/structure/types/manage/page

3) Near the bottom, I clicked on the "URL Alias Pattern" tab and to the right I was able to "Browse Available Tokens." screenshot of page content type settings form

Another place you can find tokens right out of the box, with Backdrop CMS core is in the "Accounts emails" settings - admin/config/people/emails

screenshot of user email page.

If you are looking for tokens somewhere specific and can't find them, let us know. 

TommyWillB's picture

Okay... It's in the content type setup, not the node edit screen.

I was looking for it in the node edit screen because that's where I want to insert a token... 

I was expecting something like this:

Thanks,

Tom Baker

Spatial Path

Thank you all for continuing to help with this!

As for the question of how I happened to be working with a feature that appeared not to officially exist (views field) in Backdrop at the time... That's gonna have to remain a mystery for the time being.  I know I would not have intentionally used a D7 module, and then complained without being more humble about it. So if I did do that, please accept my apologies. I'll try to find the site I was working on, and review this thing. Now I'm curious...

Thanks, all,

Eric

bugfolder's picture

In D7, there was a complete list of all tokens in the Help menu, but in Backdrop, hook_help() (and by extension, the Help menu) was removed.

I wrote a small module, Token Help, that provides that listing at admin/help/token. I'm planning on releasing it as a contrib module at some point, but you're welcome to use it now.

Ahaaah! That must have been what I was missing, that I was sure must have existed. Thanks, bugfolder.