I need to display the meta tag values from the meta tag tokens.
My Code:
function MyModule_html_head_alter(&$head_elements) {
$head_elements['metatag_description']['#value'] = $outlet_description;
}
Actual Output:
[node:node_sections] - [node:field_lead_text] Testing
Expecting Output:
Food - Testing lead text Testing
You have to use token_replace function
$menu = menu_get_item();
if($menu['path'] == 'node/%') { // check if you are on node page
$node = $menu['page arguments'][0];
$head_elements['metatag_description']['#value'] = token_replace($outlet_description, array('node' => $node));
}