You are here

function theme_hide_answer in Frequently Asked Questions 5

1 theme call to theme_hide_answer()
faq_page in ./faq.module
Function to display the faq page

File

./faq.module, line 1078

Code

function theme_hide_answer($result, $display_vars) {
  drupal_add_js(drupal_get_path('module', 'faq') . '/faq.js', 'module');
  $output = "<div>\n";
  while ($node = db_fetch_object($result)) {
    $node_obj = node_load($node->nid);
    if (node_access("view", $node_obj)) {
      $output .= '<div class="faq_question faq_dt_hide_answer">';
      $output .= l($node->title, "node/{$node->nid}") . "</div>\n";

      // should we display teaser or full text
      if ($display_vars['use_teaser']) {
        $more_link = '';
        if (!empty($display_vars['more_link']) && strlen($node->teaser) < strlen($node->body)) {
          $more_link = '<p class="faq_more_link">';
          $more_link .= l(t($display_vars['more_link']), "node/{$node->nid}") . '</p>';
        }
        $output .= '<div class="faq_answer faq_dd_hide_answer">';
        $output .= check_markup($node->teaser, $node->format, FALSE);
        $output .= $more_link . "</div>\n";
      }
      else {
        $output .= '<div class="faq_answer faq_dd_hide_answer">';
        $output .= check_markup($node->body, $node->format, FALSE) . "</div>\n";
      }
    }
  }
  $output .= "</div>\n";
  return $output;
}