You are here

function ad_get_rendered_node in Advertisement 7.3

Return a node rendered in a certain view mode, possibly from the cache.

Parameters

int $nid: The ID of node to be rendered.

string $view_mode: The view mode to render the node into.

bool $cache: (optional) Whether to use the cache, if possible. Defaults to TRUE.

Return value

string The rendered node using the provider view mode.

1 call to ad_get_rendered_node()
ad_get_ads in ./ad.module
Callback for the Ajax request to get ads.

File

./ad.module, line 302
Core code for the ad module.

Code

function ad_get_rendered_node($nid, $view_mode, $cache = TRUE) {
  if (!$cache) {
    $node = node_load($nid);
    $render_array = node_view($node, $view_mode);
    return drupal_render($render_array);
  }
  else {
    return ad_get_cache('ad_get_rendered_node', array(
      $nid,
      $view_mode,
      FALSE,
    ));
  }
}