Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Nov 2014 at 16:55 UTC
Updated:
27 Jan 2015 at 18:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damienmckennaLets make sure this is fully fixed for the next release.
Comment #2
damienmckennaCan you please install & enable the Devel module and let me know what data is shown in the 'metatags' array?
Comment #3
potop commentedI've never used Devel, so I don't know what you expect to see.
This is what it prints as a part of $page array when patch isn't applied:
And this one with my patch applied:
In first case long "description" text comes from term's description, not from metatags' description.
Comment #4
damienmckennaIf you go to the taxonomy term page you'll see a Devel tab - go to that page, click the box to make it expand out one level and you should see a "metatags" item, then let me know what it contains - a screenshot might make it easier than cutting & pasting code. Please do this on a term that you've manually assigned values to, that'll help identify where the problem might be. Thanks.
Comment #5
potop commentedLet me know if this makes more sense to you
Comment #6
damienmckennaCan you please show me what the Devel module shows on the "load" tab, e.g. "taxonomy/term/1/devel" instead of "taxonomy/term/1/devel/render"? Thanks.
Comment #7
potop commentedUnfortunately there's no "metatags" item on this page
Comment #8
damienmckenna@potop: Can you try editing the term, make some changes to the term, hit Save and then see what it says? Thanks.
Comment #9
damienmckennaComment #10
potop commentedAfter editing and saving it does show correct metatags.
If I then clear all caches it doesn't even show metatags fieldset on term's editing page, and after reloading the page fieldset is displayed with metatags fields filled by default values.
Comment #11
damienmckennaWhere are the "h1" and "seo_text_block" coming from? Did you write a custom module to add new meta tags?
Comment #12
potop commentedYes, I did!
Comment #13
damienmckennaPlease try disabling the custom module, see if that makes a difference.
Comment #14
potop commentedAs I mentioned in the original post, the reason of metatags not being loaded is the early call of metatag_entity_supports_metatags('smth').
I disabled anything custom that deals with metatags in my project but it didn't make it.
In debugger I can see that this first call of metatag_entity_supports_metatags() origins by commerce_coupon module when hook_entity_load() is invoked for commerce_coupon_type, metatag_entity_info_alter() which enables metatags support for taxonomy terms is being called later.
When I disable commerce_coupon module metatags work as expected.
Comment #15
damienmckenna@potop: Ah! That's great detail and will help a TON in tracking down the problem. Thanks!
Comment #16
damienmckenna@potop: Out of interest, are you using Commerce Coupon v1 or v2?
Comment #17
potop commentedcommerce_coupon 7.x-1.0-beta7
and I usually have both commerce_coupon_fixed_amount and commerce_coupon_pct enabled.
Haven't check who among these 3 is doing this trick with metatags.
Comment #18
damienmckennaAh! The execution process is as follows:
But, as you said yourself, at that point metatag_entity_info_alter() hasn't ran yet, so from that point onwards it won't have enabled Metatag support for entities.
Given the above, your patch makes complete sense now.
I've rerolled the patch to fix the file path issue, and tweak both metatag_entity_load() and metatag_entity_supports_metatags() slightly.
Comment #19
damienmckennaComment #21
damienmckenna@potop: Can you please give my patch a spin, just to make sure that I wasn't too ambitious with the changes? Thanks.
Comment #22
potop commented@DamienMcKenna my environment works smoothly with your patch.
btw, if you set "Needs review" status for the issue -- does it mean that my action is required?
Comment #23
damienmckenna@potop: It wasn't specifically directed at you, but in this scenario it's worth checking to see if a newer patch also resolves the problem you raised or if it either does not or introduces regressions.
Thanks for your help on this! Committed!
Comment #26
ciss commentedThis fix should come with a change notice regarding metatag_entity_supports_metatags().
I was relying on metatag_entity_supports_metatags() to preload entity types, and the change broke some of my code (easy to fix, but hard to spot).
Comment #27
damienmckenna@ciss: What was the specific problem you ran into? I've started a change notice for it but would appreciate some insight into the problem you had.
Comment #28
ciss commented@DamienMcKenna: I was calling metatag_entity_supports_metatags() without arguments to retrieve a complete list of supported entities (code). After updating metatag to HEAD, that list was empty.
In my particular case that broke the views relationships to Metatag supporting entities which I were retrieving dynamically.
Unless I've missed other functions better suited to this task, this function seems to be central in determining metatag support.