You are here

function datereminder_node_view in Date Reminder 7

Same name and namespace in other branches
  1. 6.2 datereminder.module \datereminder_node_view()

Implements hook_node_view().

1 call to datereminder_node_view()
datereminder_nodeapi in ./datereminder.module
Implements hook_nodeapi().

File

./datereminder.module, line 162
Support for reminders for nodes with dates.

Code

function datereminder_node_view($node, $view_mode, $langcode) {

  // Don't bother with teasers or other, or if reminders are
  // displayed in a tab.
  $enabled = $node->datereminder_enabled;
  if ($enabled > 0 && $view_mode == 'full') {
    $wheredisp = variable_get('datereminder_display_loc', DATEREMINDER_IN_NODE);

    // This node has reminders to display. But only display if this is
    // full (not teaser) view, and if reminders aren't under a separate tab.
    global $user;
    if (!isset($user) || $user->uid == 0) {

      // Special case, if anything other than block display,
      // maybe we want a link to prompt user to login?
      if ($wheredisp != DATEREMINDER_AS_BLOCK) {
        _datereminder_make_anonymous_link($node);
      }
    }
    elseif ($wheredisp == DATEREMINDER_IN_NODE) {
      module_load_include('inc', 'datereminder', 'includes/defines');

      // Do we actually want reminders for this node?
      if ($enabled >= DATEREMINDER_TYPE_ALLOWED) {
        $content = _datereminder_node_output($node, 'node');
        $content['#weight'] = 50;
        $node->content['reminder'] = $content;
      }
    }
  }
}