function block_inject_get_body_from_node in Block Inject 7
Helper function to retrieve proper body value from the node.
Parameters
object $node: The node object of the body.
Return value
string Sanitized body value or false if problems.
2 calls to block_inject_get_body_from_node()
- block_inject_do_injection in ./
block_inject.module - Helper function that prepares and calls the injection on a node.
- block_inject_form_node_form_alter in ./
block_inject.module - Implements hook_form_FORM-ID_alter().
File
- ./
block_inject.module, line 867 - The Block Inject module functions.
Code
function block_inject_get_body_from_node($node) {
$body = field_get_items('node', $node, 'body');
if (isset($body[0]['safe_value'])) {
return $body[0]['safe_value'];
}
if ($body[0]['format'] === 'plain_text') {
return check_plain($body[0]['value']);
}
else {
return check_markup($body[0]['value'], $body[0]['format']);
}
}