function shortcode_embed_contents_shortcode_node in Shortcode 6
Same name and namespace in other branches
- 7 shortcode_embed_contents/shortcode_embed_contents.module \shortcode_embed_contents_shortcode_node()
Insert a span around the text with highlight css class
Calling [highlight]text[/highlight]
If the length empty or invalid, between 1-99, the length will be 8
File
- shortcode_embed_contents/
shortcode_embed_contents.module, line 39
Code
function shortcode_embed_contents_shortcode_node($attrs, $text) {
extract(shortcode_attrs(array(
'nid' => 0,
'class' => '',
'teaser' => FALSE,
'show_title' => FALSE,
'show_submitted' => FALSE,
'show_terms' => FALSE,
'show_links' => FALSE,
), $attrs));
if (is_numeric($nid) && $nid) {
$node = node_load($nid);
$node->shortcode_embedded = TRUE;
if (!$node->status || !node_access('view', $node)) {
return '';
}
}
else {
return '';
}
$params = new stdClass();
$params->embedded = TRUE;
$params->teaser = shortcode_bool($teaser);
$params->show_title = shortcode_bool($show_title);
$params->show_meta = shortcode_bool($show_meta);
$params->show_submitted = shortcode_bool($show_submitted);
$params->show_terms = shortcode_bool($show_terms);
$params->show_links = shortcode_bool($show_links);
// insert the original attributes to the params
$params->attrs = $attrs;
$node->shortcode = $params;
//dpr($params);
$output = node_view($node, $params->teaser);
return $output;
}