Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Due to some temporary work-arounds for limitations in Panels and Views, it's possible that metatag_entity_view() may be triggered more than once during a page load. Add some logic so that it's only ran once.
Comment | File | Size | Author |
---|---|---|---|
#4 | metatag-n1932192-4.patch | 896 bytes | DamienMcKenna |
#1 | metatag-n1932192-1.patch | 681 bytes | DamienMcKenna |
Comments
Comment #1
DamienMcKennaThis should do it.
Comment #2
DamienMcKennaCommitted.
Comment #3
slayne40 CreditAttribution: slayne40 commentedHy,
I have a node with Entity Reference field.
During page load, the function metatag_entity_view is called once.
Problem on call : entity ID is not the node ID of the page but a referenced node ID... function end and the metatags are empty !
It is necessary that the function is called more than once.
If I delete the patch metatag work properly.
The solution may be to move the patch after the line :
or maybe not ?
Comment #4
DamienMcKennaHow's about this?
Comment #5
DamienMcKennaCommitted.
Comment #6
DamienMcKennaNow that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.
Comment #7
IRuslan CreditAttribution: IRuslan commentedI'm still encounter that issue in last release version.
I'm using CTools, first call comes from ctools_node_content_render_node() plugin, which invoke full entity_view.
And second comes from metatag_ctools_render_alter().
And usage of $i_will_say_this_only_once does not help because metatag_entity_view() called second tiome with $force flag.
What's the reason to have that flag and use it in metatag_ctools_render_alter()?
Comment #8
Raphael Apard CreditAttribution: Raphael Apard commentedWith a node with comment, _metatag_entity_is_page('comment', $comment) will return TRUE and $i_will_say_this_only_once will be set to true, and this will never triggered for node.