Active
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2012 at 16:13 UTC
Updated:
14 Nov 2012 at 17:41 UTC
Hi all,
I'm trying to modify the og:description metatag fro a specific node type, so here what I did:
function myModule_metatag_metatags_view_alter(&$output, $instance) {
if ($instance == 'node:media_gallery') {
if (isset($output['og:description']['#attached']['drupal_add_html_head'][0][0]['#value'])) {
$output['og:description']['#attached']['drupal_add_html_head'][0][0]['#value'] = _myModule_get_description();
}
}
}
Now I have to write the callback function _myModule_get_description() where I'm going to build the description based on some fields belonging to the node.
The problem is that I don't know how to retrieve these node information (nid, fields and so on) from here.
Please help me, I'm not a programmer but I want learn how to do this kind of stuff.
Thank you very much for give me some advices
Comments
Comment #1
damienmckennaFYI it might be easier to create a new set of defaults for that content type and then just build a token to insert the data you want?
Comment #2
mxtI've found this working solution for now:
DamienMcKenna: thank you, I'll go to explore your suggestion with token (despite I absolutely don't know where to start..)