I'm trying to add a couple of extra fields to the data table in project_issues module, and have managed to hook into that module as they set it up to be able to do.

The actual content of the new rows I want to add is to come from cck fields i added to the content type, which just show up wherever they feel like and not as part of the data table. I added a function in template.php that adds the rows I need, but I can't get the content of those cck fields to fill in there. Template.php function is below:

/**
 * Themes the metadata table and internal page links for issue nodes.
 *
 * @param $current_data
 *   An array of current issue data for the metadata table.
 * @param $summary_links
 *   An array of internal page links.
 * @return
 *   An HTML string of the summary section.
 */
function phptemplate_project_issue_summary($current_data, $summary_links) {
  $allowed_tags = array('a', 'em', 'strong');
  $rows = array();
  
    $current_data['page'] = array(
      'label' => t('Page'),
      'current' => $node->content['field_page']['#value'],
    );
    $current_data['phase'] = array(
      'label' => t('Phase'),
      'current' => $node->content['field_phase']['#value'],
    );
  
  foreach ($current_data as $name => $values) {
    $rows[] = array(filter_xss($values['label'], $allowed_tags) .':', filter_xss($values['current'], $allowed_tags));
  }

  $output = '<div id="project-summary-container" class="clear-block">';
  $output .= '<div id="project-issue-summary-table" class="summary">'. theme('table', array(), $rows) .'</div>';
  if (!empty($summary_links)) {
    $output .= '<div id="project-issue-summary-links">'. theme('item_list', $summary_links, t('Jump to:'), 'ul', array('class' => 'internal-links')) .'</div>';
  }
  $output .= '</div>';

  return $output;
}

Comments

yuriy.babenko’s picture

Why not just make a query to pull what you need directly from the database?
---
Yuriy Babenko
www.yubastudios.com

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

gellpak’s picture

Don't know why I didn't think of that. Still, I just feel there must be a more elegant, planned-for solution to access those variables than to have to add more database queries whenever I need more info.

Currently I've got it working by creating a custom template for the node type I'm using, disabling the $content output, and using php to reconstruct what it normally would have output but with the variables added in that I need, which ARE available in the page template. Also not very elegant, but it works and it's much easier to customize this way since everything is in one place...