You are here

public function FrxDrupal::drupal_filter in Forena Reports 7

Same name and namespace in other branches
  1. 6 plugins/FrxDrupal.inc \FrxDrupal::drupal_filter()

File

plugins/FrxDrupal.inc, line 92
Provides data blocks for native drupal connections using the default drupal connections.

Class

FrxDrupal
@file Provides data blocks for native drupal connections using the default drupal connections.

Code

public function drupal_filter($nid, $format) {
  $node = node_load($nid, NULL, TRUE);
  if (!$node) {
    return 'N/A';
  }
  if (strcasecmp($format, 'teaser') == 0 || !$format) {
    $bool = TRUE;
  }
  else {
    $bool = FALSE;
  }

  //If true, render the teaser

  //else render the body
  $node = node_prepare($node, $bool);
  if ($bool) {
    return $node->teaser;
  }
  return $node->body;
}