function fb_graph_preprocess_page in Drupal for Facebook 6.3
Same name and namespace in other branches
- 7.3 fb_graph.module \fb_graph_preprocess_page()
Implements hook_preprocess_page().
Adds our meta tags to the html header.
File
- ./
fb_graph.module, line 199 - Open Graph Helpers
Code
function fb_graph_preprocess_page(&$vars) {
$tags = fb_graph_get_tags(TRUE);
if (count($tags)) {
foreach ($tags as $key => $value) {
if (is_array($value)) {
// Arrays represent multiple properties for same key. I.e. og:image
foreach ($value as $val) {
$markup = '<meta property="' . check_plain($key) . '" content="' . check_plain($val) . '" />';
drupal_set_html_head($markup);
}
}
else {
// $value is a single string.
$markup = '<meta property="' . check_plain($key) . '" content="' . check_plain($value) . '" />';
drupal_set_html_head($markup);
}
}
$vars['head'] = drupal_get_html_head();
}
}