You are here

public static function OpenGraphMetaDrupalLayer::get_node_body in Open Graph meta tags 7

Same name and namespace in other branches
  1. 6 opengraph_meta.common.inc \OpenGraphMetaDrupalLayer::get_node_body()

Get contents of node body.

Parameters

$node the node object.:

Return value

empty string if no body found.

4 calls to OpenGraphMetaDrupalLayer::get_node_body()
OGMTBasicTest::testNodeOverrideDefaultImage in tests/Basic.test
OGMTBasicTest::testNodeOverridesEmptyValues in tests/Basic.test
OpenGraphMeta::get_og_tag_defaults in ./opengraph_meta.common.inc
Get default values for all meta tags (including optional ones).
OpenGraphMeta::harvest_images_from_node in ./opengraph_meta.common.inc
Harvest all images from the given node.

File

./opengraph_meta.common.inc, line 477

Class

OpenGraphMetaDrupalLayer
Drupal compatibility layer.

Code

public static function get_node_body($node) {
  $body = '';
  $lang = field_language('node', $node, 'body');
  $lang = $lang ? $lang : LANGUAGE_NONE;
  if (!empty($node->body[$lang]['0']['value'])) {
    $body = $node->body[$lang]['0']['value'];
  }
  return $body;
}