You are here

function spaces_calendar_nodeapi in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_calendar/spaces_calendar.module \spaces_calendar_nodeapi()

Implementation of hook_nodeapi()

File

spaces_calendar/spaces_calendar.module, line 82

Code

function spaces_calendar_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($op == 'view' && !$teaser && $page) {
    _spaces_calendar_alter_links();
    if ($node->type == variable_get('spaces_calendar_feed_nodetype', '')) {
      $view = views_get_view('spaces_calendar_ical_items');
      $view = views_build_view('embed', $view, array(
        $node->nid,
      ), $view->pager, $view->nodes_per_page);
      if ($view) {
        $node->content['item_list'] = array(
          '#value' => $view,
          '#weight' => 10,
        );
      }
      $node->content['buttons'] = array(
        '#value' => "<div class='buttons'>" . l(t('View calendar'), 'calendar', array(
          'class' => 'button',
        )) . "</div>",
        '#weight' => 5,
      );
    }
  }
}