Hi there. I've been using this module successfully for a while now, but at some point recently it stopped working with an embedded media field that was using [node:url] (it's a thumbnail of a YouTube or Vimeo video). Now I can't use anything other than [field-item:delta] and [field-item:raw]. Nothing else shows up in the token browser, and manually entering [node:url] doesn't work. I'm currently developing the site, and I didn't notice it right away, so I have no idea what other module might be affecting it, or if some recent updates are the culprit. I've tried uninstalling the module (i.e. deleting its data via the Modules -> Uninstall page), reinstalling it, but that didn't fix the issue. Has anyone seen this before, and might there be an idea of what I might do to track down the issue? Thanks.

UPDATE: As mentioned in the discussion below, this actually seems to be affecting other modules that use tokens. Will update if I find a fix.

Comments

ambient.impact’s picture

It seems that I've found a workaround: clearing the cache via Drush seems to restore all the tokens, but clearing it via the Performance page causes this bug to re-appear. Hope this helps someone.

damienmckenna’s picture

Status: Active » Postponed (maintainer needs more info)

I don't see how this could be the culprit? Maybe check if the Pathauto module is also affected?

ambient.impact’s picture

You're right. It looks like Pathauto and Metatag are both experiencing the same issue, so it's probably to do with tokens in general. I'll have to dig around and see if I can figure out what's at the root of it. Have you heard of such a bug before? Any ideas? Thanks.

damienmckenna’s picture

Project: Linked Field » Token
Version: 7.x-1.9 » 7.x-1.5
Component: Code » User interface
Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Active

I haven't, but maybe someone in the Token issue queue has?

ambient.impact’s picture

Thanks. I'll try a few things, like reinstalling Token, etc., and post here if I find anything myself.

ambient.impact’s picture

Title: Node tokens missing » Tokens missing
Issue summary: View changes
ambient.impact’s picture

Title: Tokens missing » Tokens missing on cache clear
ambient.impact’s picture

Status: Active » Closed (works as designed)

It turns out that it's not a good idea to use url() in a .module file outside of a function. That was causing this and other, seemingly unrelated issues. I hope this is a cautionary tale for others not to do dumb stuff like I did. :P

Ankur9135’s picture

Hi, I am facing the same problem, in which line or function we have to do #8

pamelalies’s picture

I was trying to track down this issue for a couple of months, and I finally found the solution for our sites! I thought I would post it here in case anyone else might have the same root cause - because it wasn't an easy one to track down.

I know a lot of people mentioned that it started happening after upgrading PHP to 7.4. In our case the problem was caused by the Colorfield module, which has some of the "curly braces" code, which is deprecated in PHP 7.4.

I applied this patch to our installed Colorfield module, and it fixed this issue that's been plaguing us.

https://www.drupal.org/project/colorfield/issues/3163653

You wouldn't think that a module throwing a warning would break so many other things, but in this case it did. If this isn't your exact problem, you might try fixing any other curly braces deprecations in any other modules you might have installed and see if it helps you as it did us.