diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php index 8d2b8c4..0cb7642 100644 --- a/core/themes/bartik/template.php +++ b/core/themes/bartik/template.php @@ -70,6 +70,29 @@ function bartik_process_page(&$variables) { // Make sure the shortcut link is the first item in title_suffix. $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } + + // Render all regions ahead of time, so simple variables can be used in the template file. + $variables['header'] = render($variables['page']['header']); + $variables['featured'] = render($variables['page']['featured']); + $variables['sidebar_first'] = render($variables['page']['sidebar_first']); + $variables['highlighted'] = render($variables['page']['highlighted']); + $variables['help'] = render($variables['page']['help']); + $variables['content'] = render($variables['page']['content']); + $variables['sidebar_second'] = render($variables['page']['sidebar_second']); + $variables['triptych_first'] = render($variables['page']['triptych_first']); + $variables['triptych_middle'] = render($variables['page']['triptych_middle']); + $variables['triptych_last'] = render($variables['page']['triptych_last']); + $variables['footer_firstcolumn'] = render($variables['page']['footer_firstcolumn']); + $variables['footer_secondcolumn'] = render($variables['page']['footer_secondcolumn']); + $variables['footer_thirdcolumn'] = render($variables['page']['footer_thirdcolumn']); + $variables['footer_fourthcolumn'] = render($variables['page']['footer_fourthcolumn']); + $variables['footer'] = render($variables['page']['footer']); + + // Convert complex data structures into HTML variables for use in the template file. + $variables['tabs'] = render($variables['tabs']); + $variables['title_prefix'] = render($variables['title_prefix']); + $variables['title_suffix'] = render($variables['title_suffix']); + $variables['action_links'] = render($variables['action_links']); } /** @@ -110,6 +133,54 @@ function bartik_preprocess_node(&$variables) { } /** + * Override or insert variables into the node template. + */ +function bartik_process_node(&$variables) { + // Remove the "Add new comment" link on the teaser page + // or if the comment form is being displayed on the same page. + if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { + unset($variables['content']['links']['comment']['#links']['comment-add']); + } + + // Render the content ahead of time, so simple variables can be used in the template file. + $variables['comments'] = render($variables['content']['comments']); + $variables['links'] = render($variables['content']['links']); + // Render the content after links and comments. + $variables['content'] = render($variables['content']); + + // Convert complex data structures into HTML variables for use in the template file. + $variables['title_prefix'] = render($title_prefix); + $variables['title_suffix'] = render($title_suffix); +} + +/** + * Override or insert variables into the comment wrapper template. + */ +function bartik_process_comment_wrapper(&$variables) { + // Render the content ahead of time, so simple variables can be used in the template file. + $variables['comments'] = render($variables['content']['comments']); + $variables['comment_form'] = render($variables['content']['comment_form']); + + // Convert complex data structures into HTML variables for use in the template file. + $variables['title_prefix'] = render($title_prefix); + $variables['title_suffix'] = render($title_suffix); +} + +/** + * Override or insert variables into the comment template. + */ +function bartik_process_comment(&$variables) { + // Render the content ahead of time, so simple variables can be used in the template file. + $variables['links'] = render($variables['content']['links']); + // Render the content after links. + $variables['content'] = render($variables['content']); + + // Convert complex data structures into HTML variables for use in the template file. + $variables['title_prefix'] = render($title_prefix); + $variables['title_suffix'] = render($title_suffix); +} + +/** * Override or insert variables into the block template. */ function bartik_preprocess_block(&$variables) { diff --git a/core/themes/bartik/templates/comment-wrapper.tpl.php b/core/themes/bartik/templates/comment-wrapper.tpl.php index 864dc41..59f5db2 100644 --- a/core/themes/bartik/templates/comment-wrapper.tpl.php +++ b/core/themes/bartik/templates/comment-wrapper.tpl.php @@ -12,12 +12,10 @@ * CSS. It can be manipulated through the variable $classes_array from * preprocess functions. The default value has the following: * - comment-wrapper: The current template type, i.e., "theming hook". - * - $title_prefix (array): An array containing additional output populated by - * modules, intended to be displayed in front of the main title tag that - * appears in the template. - * - $title_suffix (array): An array containing additional output populated by - * modules, intended to be displayed after the main title tag that appears in - * the template. + * - $title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - $title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. * * The following variables are provided for contextual information. * - $node: Node object the comments are attached to. @@ -32,20 +30,21 @@ * into a string within the variable $classes. * * @see template_preprocess_comment_wrapper() + * @see bartik_process_comment_wrapper() * @see theme_comment_wrapper() */ ?>