You are here

function calendar_node_view in Calendar 7.3

Implements hook_node_view().

Add link to calendar to nodes, formerly hook_link(). Controlled by value of 'calendar_date_link' in the view.

File

./calendar.module, line 279
Adds calendar filtering and displays to Views.

Code

function calendar_node_view($node, $view_mode, $langcode) {
  $path = variable_get('calendar_date_link_' . $node->type);
  if (!empty($path)) {
    $links['calendar_link'] = array(
      'title' => t('Calendar'),
      'href' => $path,
      'attributes' => array(
        'title' => t('View the calendar.'),
      ),
    );
    $node->content['links']['calendar'] = array(
      '#theme' => 'links__node__calendar',
      '#links' => $links,
      '#attributes' => array(
        'class' => array(
          'links',
          'inline',
        ),
      ),
    );
  }
}