Index: project.module =================================================================== --- project.module (revision 569) +++ project.module (working copy) @@ -71,6 +71,10 @@ 'info' => t('Project navigation (text field)'), 'cache' => BLOCK_CACHE_PER_ROLE, ); + $blocks[3] = array( + 'info' => t('Project links'), + 'cache' => BLOCK_CACHE_PER_ROLE, + ); return $blocks; } else if ($op == 'view') { @@ -96,6 +100,13 @@ 'content' => drupal_get_form('project_quick_navigate_title_form'), ); break; + + case 3: + $block = array( + 'subject' => t('Links'), + 'content' => project_links_block_output(), + ); + break; } return $block; } @@ -114,6 +125,27 @@ } } +/** + * Function that outputs the content of a project Links block. + */ +function project_links_block_output() { + if (arg(0) != 'node' && !is_numeric(arg(1))) { + return; + } + $node = node_load(arg(1)); + $items = array(); + if ($node->project['demo']) { + $items[] = l(t('Try out a demonstration'), $node->project['demo']); + } + if ($node->project['homepage']) { + $items[] = l(t('Home page'), $node->project['homepage']); + } + if (count($items)) { + $output = theme('item_list', $items); + } + return $output; +} + function project_search_block_form($form_state, $node_type) { $form = search_box($form_state, 'project_search_block_form'); $form['node_type'] = array(