opengraph_meta.drupal7-hooks.inc in Open Graph meta tags 7
File
opengraph_meta.drupal7-hooks.inc
View source
<?php
function opengraph_meta_permission() {
return array(
OPENGRAPH_META_PERM_ADMIN => array(
'title' => t('Administer Open Graph meta tags'),
'description' => t('Administer default Open Graph meta tags options'),
),
OPENGRAPH_META_PERM_EDIT => array(
'title' => t('Edit Open Graph meta tags'),
'description' => t('Edit Open Graph meta tags on a node'),
),
);
}
function opengraph_meta_node_load($nodes, $types) {
foreach ($nodes as &$node) {
if (OpenGraphMeta::instance()
->tags_are_enabled_for_content_type($node->type)) {
$node->opengraph_meta = OpenGraphMeta::instance()
->load_node_data($node);
}
}
}
function opengraph_meta_node_view($node, $view_mode, $langcode) {
if (!empty($node->opengraph_meta) && node_is_page($node)) {
OpenGraphMeta::instance()
->render_data($node, $node->opengraph_meta);
}
}
function opengraph_meta_node_insert($node) {
opengraph_meta_node_update($node);
}
function opengraph_meta_node_update($node) {
if (!empty($node->opengraph_meta)) {
OpenGraphMeta::instance()
->save_node_data($node->nid, $node->opengraph_meta);
}
}
function opengraph_meta_node_delete($node) {
OpenGraphMeta::instance()
->delete_node_data($node->nid);
}