In the Metatag module, it states the following below the Image field in Open Graph:

Multiple values may be used, separated by a comma. Note: Tokens that return multiple values will be handled automatically. This will be able to extract the URL from an image field.

Maybe I'm missing something, but this is not how it seems to work. Getting lots of error messages on node pages regarding broken URLs, and when looking at the source HTML, I see the following:

<link rel="image_src" href="http://test-site.com/Array" />
<meta property="og:image" content="http://test-site.com/Array" />
<meta property="og:image:secure_url" content="https://test-site.com/Array" />

The settings in Metatag seem fairly straightforward -- this is what exists for Open Graph Image field:

[node:field_header_image:640x360],[node:field_image:640x360]

Any suggestions?

Comments

ron_s created an issue. See original summary.

sgdev’s picture

Title: Tokens that return multiple values will be handled automatically » Does not work with File Entity fields, even though module has option to enable them
Category: Support request » Bug report

Have been investigating this a bit further, and it seems to me there is a fundamental flaw with this module. It suggests there is support for File Entity fields, but it really doesn't work.

Every token for an image that is a file entity runs through the _file_entity_tokens_get_property() function. This function splits the token, and expects the second part between colons to be the $property value.

Image style is not a supported property value -- the values are defined in file_entity_token_info(). The available options are as follows:

* field
* url
* filename
* filemime
* type
* image
* height
* width
* https-url
* https-image

So a token with [node:field_header_image:640x360], and field_header_image as a file field is going to fail. An image style of 640x360 is never a valid property for _file_entity_tokens_get_property().

Researching this a bit further, I'm not sure how the current approach would ever work for file entities. There either needs to be a patch to File Entity such that the file_entity_tokens function is bypassed, or there needs to be a completely different token format for this module. If not, conflicts will occur.

Maybe something like [imagecache:node:field_header_image:640x360] as an alternative.

sgdev’s picture

Component: Code » Integration with other media modules
das-peter’s picture

Status: Active » Closed (works as designed)
Related issues: +#2947445: Undefined index: {file_style} in _file_entity_tokens_get_property()

I think this is actually more an issue of the file_entity module. It returns NULL for a token it doesn't know - breaking all subsequent handling.
This issue is addressed here: #2947445: Undefined index: {file_style} in _file_entity_tokens_get_property()

I'm closing this because I think the module actually does what it is supposed to do :)

edit: Proper linking to related ticket.

damienmckenna’s picture

Thanks for finding that, das-peter!