You are here

function sheetnode_phpexcel_node_view in Sheetnode 7

Same name and namespace in other branches
  1. 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \sheetnode_phpexcel_node_view()

Implements hook_node_view().

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.module, line 171
Module file for the sheetnode_phpexcel module. This manages handling of files for sheetnode.

Code

function sheetnode_phpexcel_node_view($node, $view_mode) {
  if ($node->type != 'sheetnode' && !sheetnode_get_sheetfields($node->type) || !variable_get('sheetnode_phpexcel_export_links', TRUE)) {
    return;
  }
  $links = array();
  foreach (sheetnode_phpexcel_get_plugins('output') as $format => $plugin) {
    $links[$format] = array(
      'title' => t('Save as !format', array(
        '!format' => $plugin['short-name'],
      )),
      'href' => "sheetnode/{$format}/{$node->nid}",
    );
  }
  $node->content['links']['sheetnode_phpexcel'] = array(
    '#theme' => 'links',
    '#links' => $links,
    '#attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
  );
}