Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Apr 2014 at 03:42 UTC
Updated:
18 May 2016 at 13:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rooby commentedMy initial code example:
doesn't work.
Basically the best way seems to be to replicate metatags_entity_view() but without the specifics that make that function only work for the current page.
Like this:
Comment #2
rooby commentedComment #3
rooby commentedComment #4
rooby commentedHere is a patch that makes it easy for another module to generate tags for an entity.
I included as an optional extra the metatags_get_entity_metatags() function, which further simplifies what a user would have to do to get the metatags, but maybe that part isn't really necessary.
Comment #6
rooby commentedOops, new patch.
I don't love the idea of using entity_extract_ids() twice but the alternatives aren't really that crash hot either.
Comment #7
rooby commentedHere is a new version of the patch for latest dev.
Comment #10
damienmckennaI tested this out locally, ran through a few scenarios, and everything still worked =) This is a great improvement, and finally provides a way of obtaining the final meta tags for a given entity. Thank you! I've committed this after some testing and review of the changes.
Comment #11
rooby commentedGreat, thanks!
Comment #13
RAWDESK commented@rooby,
I've been experimenting with #1 for this goal :
-> programmatically create nodes from a remote http feed
-> load entity meta tags as by default configured in metatags UI (your get_entity_metatags helper function)
-> modify specific tags like og:locality og:latitude etc etc based on given http feed attributes
Is it possible to somehow save this by your helper function created output array ?
Have been looking inside the metatag.module for a crUd and could only come up with this provided function :
dpm'ing the 4 argument just gave me 2 metatags as shown in attached screenshot.
Comment #14
damienmckennaI've updated the documentation of metatag_metatags_save(), please open a new issue or let us know in #1466292: Document all Metatag's hooks if there's anything else that needs documentation. Thanks.