Commit e81096f5 authored by Dries's avatar Dries

- Patch #372471 by JamesAn et al: killed theme_box().

parent a6233dfe
......@@ -1473,21 +1473,6 @@ function theme_tablesort_indicator($style) {
}
}
/**
* Return a themed box.
*
* @param $title
* The subject of the box.
* @param $content
* The content of the box.
* @return
* A string containing the box output.
*/
function theme_box($title, $content) {
$output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
return $output;
}
/**
* Return a themed marker, useful for marking new or updated
* content.
......
......@@ -128,6 +128,9 @@ function comment_theme() {
'template' => 'comment',
'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()),
),
'comment_form_box' => array(
'arguments' => array('edit' => NULL, 'title' => NULL),
),
'comment_folded' => array(
'template' => 'comment-folded',
'arguments' => array('comment' => NULL),
......@@ -1197,7 +1200,7 @@ function comment_render($node, $cid = 0) {
// If enabled, show new comment form if it's not already being displayed.
$reply = arg(0) == 'comment' && arg(1) == 'reply';
if (user_access('post comments') && $node->comment == COMMENT_NODE_OPEN && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) {
$output .= comment_form_box(array('nid' => $nid), t('Post new comment'));
$output .= theme('comment_form_box', array('nid' => $nid), t('Post new comment'));
}
if ($output) {
$output = theme('comment_wrapper', $output, $node);
......@@ -1624,9 +1627,13 @@ function comment_form(&$form_state, $edit, $title = NULL) {
* The form structure.
* @param $title
* The form title.
* @return
* A string containing the box output.
*/
function comment_form_box($edit, $title = NULL) {
return theme('box', $title, drupal_get_form('comment_form', $edit, $title));
function theme_comment_form_box($edit, $title = NULL) {
$content = drupal_get_form('comment_form', $edit, $title);
$output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
return $output;
}
/**
......
......@@ -20,7 +20,7 @@ function comment_edit($cid) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
if (comment_access('edit', $comment)) {
return comment_form_box((array)$comment);
return theme('comment_form_box', (array)$comment);
}
else {
drupal_access_denied();
......@@ -58,7 +58,7 @@ function comment_reply($node, $pid = NULL) {
// The user is previewing a comment prior to submitting it.
if ($op == t('Preview')) {
if (user_access('post comments')) {
$output .= comment_form_box(array('pid' => $pid, 'nid' => $node->nid), NULL);
$output .= theme('comment_form_box', array('pid' => $pid, 'nid' => $node->nid), NULL);
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
......@@ -101,7 +101,7 @@ function comment_reply($node, $pid = NULL) {
drupal_goto("node/$node->nid");
}
elseif (user_access('post comments')) {
$output .= comment_form_box(array('pid' => $pid, 'nid' => $node->nid), t('Reply'));
$output .= theme('comment_form_box', array('pid' => $pid, 'nid' => $node->nid), t('Reply'));
}
else {
drupal_set_message(t('You are not authorized to post comments.'), 'error');
......
......@@ -134,6 +134,9 @@ function search_theme() {
'file' => 'search.pages.inc',
'template' => 'search-results',
),
'search_results_listing' => array(
'arguments' => array('title' => NULL, 'content' => NULL),
),
);
}
......
......@@ -32,10 +32,10 @@ function search_view($type = 'node') {
$results = search_data($keys, $type);
if ($results) {
$results = theme('box', t('Search results'), $results);
$results = theme('search_results_listing', t('Search results'), $results);
}
else {
$results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
$results = theme('search_results_listing', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
}
}
......@@ -49,6 +49,21 @@ function search_view($type = 'node') {
return drupal_get_form('search_form', NULL, empty($keys) ? '' : $keys, $type);
}
/**
* Theme the listing of search results
*
* @param $title
* The subject of the listing.
* @param $content
* The content of the listing.
* @return
* A string containing the listing output.
*/
function theme_search_results_listing($title, $content) {
$output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
return $output;
}
/**
* Process variables for search-results.tpl.php.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment