You are here

function phptemplate_box in Node and Comments Form Settings 6.2

Same name and namespace in other branches
  1. 6.3 commentformsettings/commentformsettings.module \phptemplate_box()

Theme function to alter the comments form

File

commentformsettings/commentformsettings.module, line 264
main file, only one hook_form_alter to change several settings

Code

function phptemplate_box($title, $content, $region = 'main') {
  $node = menu_get_object();
  if (isset($node)) {
    $settings = commentformsettings_get_settings($node->type);
    if ($title == "Post new comment" && $settings['cfs_pnc']['cfs_post_new_comment'] == 1) {
      $title = '';
    }
    if ($title == "Post new comment" && $settings['cfs_pnc']['cfs_post_new_comment'] == 2 && isset($settings['cfs_pnc']['cfs_post_new_comment_value'])) {
      $title = t($settings['cfs_pnc']['cfs_post_new_comment_value']);
    }
    if (isset($settings['cfs_pnc']['cfs_post_new_comment_tag'])) {
      $output = '<' . $settings['cfs_pnc']['cfs_post_new_comment_tag'] . ' class="title">' . $title . '</' . $settings['cfs_pnc']['cfs_post_new_comment_tag'] . '><div>' . $content . '</div>';
    }
    else {
      $output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
    }
  }
  else {

    // Default value
    $output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
  }
  return $output;
}