Not sure if these are separate bugs or if they are symptoms of the same issue.

Issue Part 1:

The current Placeholder Tokens listed in the Custom Breadcrumbs form seem to be Drupal 6 tokens, not Drupal 7 tokens.

Adding tokens like [content-type:name] listed on the Placeholder Tokens form page do not display when saved. I checked the Autonode Titles token list and added tokens like [node:content-type]. That displays the correct information.

Issue Part 2:

Special Identifiers
|[token] display correctly when by itself. However adding something/
|[token] does not. On the node page, the link displays as something/
|[token]

Comments

jcarlson34’s picture

Darn it... forgot to add the code text...

Issue Part 2:

Special Identifiers <pathauto>|[token] display correctly when by itself. However adding something/<pathauto>|[token] does not. On the node page, the link displays as something/<pathauto>|[token]

MGN’s picture

I am not sure how the tokens could be Drupal 6 tokens. What makes you think they are D6?

I think the problem is the usual one. For tokens to be replaced you have to have an appropriate object. This module (at least custom breadcrumbs 6.x-1.x and 7.x-1.x branches) only uses the node object. So only node tokens will work (so far).

I think the confusion comes from the fact that the token tree is showing all tokens, but it should only show the tokens that custom breadcrumbs can use: In custom_breadcrumbs.admin.inc:

theme('token_tree', array('token_types' => 'all', 'click_insert' => FALSE)) should really be theme('token_tree', array('token_types' => 'node', 'click_insert' => FALSE)). I'll fix this on the next commit.

In custom breadcrumbs 2, there

The special identifier (in the current implementation) has to be at the start of the line, so try:

<pathauto>|something/[token]

jcarlson34’s picture

Title: Placeholder Tokens and Special Identifiers Issues » Placeholder Tokens Issue

Hmm. Sorry about the Drupal 6 thing, I just though it possibly was due to the module being ported without any changes to the token part of the code. The more I am thinking about it, I wonder if I am describing tokens from the Tokens module instead of the tokens from drupal core?

The issue I was trying to describe in #0 is that none of the placeholder tokens that I've tested seem to work currently for. But the tokens list found on other modules (using the Token module) do. And those lists of tokens have a different format than the ones displayed in placeholder tokens.

If you have the tokens module installed, for testing this, try changing the following code in custom_breadcrumbs.admin.inc from:

    $form['help']['tokens'] = array(
      '#markup' => theme('token_tree', array('token_types' => 'all', 'click_insert' => FALSE)),
    );

to:

    $form['help']['token_help'] = array(
        '#theme' => 'token_tree',
        '#token_types' => array('node'),
      );

to see what I am trying to say.

Also thank you for the special identifier tip. <pathauto>|something/[token] did work brilliantly. Could you potentially put that into the documentation? Seeing <pathauto>|[token] made me assume something/<pathauto>|[token]. Having that documented explicitly might help clarify how it works for others.

Thank you for a great module and great support MGN!

MGN’s picture

Status: Active » Postponed (maintainer needs more info)

Yes, that code snippet is exactly what I was moving toward for the 7.x-1.x branch. Your suggestion limits the tree t just node-type tokens and those tokens that don't require an object (like site, current user, date, etc). I haven't tested most of the tokens, but they should all work. Custom breadcrumbs just uses the token_replace() api function with the node object - it doesn't add any tokens or do any token processing on its own.

So I am not sure that I see a bug here. What placeholder tokens are you testing?

I will update the docs to better indicate that the special identifier needs to be at the beginning of the line.

jcarlson34’s picture

Status: Postponed (maintainer needs more info) » Fixed

Shoot you are right... '#token_types' => array('node'), is limiting to nodes only. I'm still a coding noob. :-/

Also, I think I figured out my issue. I confused the 'Content types' section with the 'Nodes' section. Now I see 'Nodes' farther down the list. No wonder [content-type:name] and [node:content-type] look different and why [content-type:name] didn't show a breadcrumb result on a node page.

Sigh I am really sorry for wasting your time on my error. Thanks for your help MGN.

Status: Fixed » Closed (fixed)

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