You are here

function theme_forward_link in Forward 7.2

Same name and namespace in other branches
  1. 7.3 forward.module \theme_forward_link()

Theme function for Forward link

5 theme calls to theme_forward_link()
forward_block_view in ./forward.module
Implements hook_block_view().
forward_ds_field_create in ./forward.module
Callback for Display Suite field.
forward_handler_field_forward_link::render in views/forward_handler_field_forward_link.inc
Render the field.
forward_panels_node_render in plugins/content_types/forward_node.inc
forward_panels_page_render in plugins/content_types/forward_page.inc

File

./forward.module, line 193

Code

function theme_forward_link($variables) {
  $node = isset($variables['node']) ? $variables['node'] : NULL;
  $path = isset($variables['path']) ? $variables['path'] : NULL;
  $block = isset($variables['block']) ? $variables['block'] : FALSE;

  // Handle a node path (node/nid) with no node
  if (!$node && $path) {
    $args = explode('/', $path);
    if (count($args) == 2 && $args[0] == 'node' && is_numeric($args[1])) {
      $node = node_load($args[1]);
    }
  }

  // Generate the link unless given a bad path
  $output = '';
  if (!$path || !url_is_external($path)) {
    $link = forward_link_create($node, $path, $block);
    $output = $link['content'];
  }
  return $output;
}