Despite alt being shown as an available token, attempting to use it to populate the Twitter Card Alternative Text metatag results in an error.

Steps:
1. Enable a field in content types named Image
2. Enable alternate text for the image
3. Install and enable the Metatag and Metatag: Twitter Cards modules
4. Go to /admin/config/search/metatags/config/node
5. Enter the following in Twitter Card Image URL field: [node:field_image]
6. Enter the following in Twitter Card Image alternative text: [node:field_image:alt]
7. Click Save button

Expected results: Configuration is saved
Actual results: Twitter Card Image alternative text is outlined in red. Error message:
The Image alternative text is using the following invalid tokens: [node:field_image:alt].

Note: If, in the Twitter Card section, I click Browse available tokens, I get the following information under Image:

Field "field_image". The following properties may be appended to the token: file (The image file.), alt (The "Alt" attribute text)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Charles Belov created an issue. See original summary.

DamienMcKenna’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)
FileSize
94.43 KB
176.12 KB

That token isn't available out of the box with Drupal core or the Token module:

The tokens that core + Token module give you.

If you install Imagecache Token you'll get extra tokens for each image field:

The tokens you can get when you install Imagecache Token.

Is that what you were looking for?

Charles Belov’s picture

Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Closed (works as designed)

Nope, it was my bad, sorry.

It appears the tokens are inconsistent as to whether they require underscores or hyphens between words.

Image [node:field-director:field_image] Image field. Also known as Large Image (770 pixels wide).
Image [node:field-director:field-image:?] Field "field_image". The following properties may be appended to the token: file (The image file.), alt (The "Alt" attribute text)

If I use [node:field-director:field-image:alt], it works. That is, the program saves my configuration and displays the correct metatag and contents in the content page output.

That's what I get for not copying and pasting.

Changing category to support and closing.

DamienMcKenna’s picture

Ah! That means you have the Entity Token module installed. There's a long-standing conflict between that module and the Token module, see #1272560: Entity tokens duplicates field tokens created by token module for more. Sorry about that.

Charles Belov’s picture

Thank you for the detective work. Confirmed and now following that issue.

Charles Belov’s picture

And actually, I'm guessing that explains why sometimes I get the tokens as insertion links and sometimes I don't. That if Token is ruling, I get the links and if Entity Token is ruling I don't get the links and have to copy and paste. This is only a guess.