]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
using elgg_view_title() in content layout header
authorCash Costello <cash.costello@gmail.com>
Tue, 28 Jun 2011 11:30:22 +0000 (07:30 -0400)
committerCash Costello <cash.costello@gmail.com>
Tue, 28 Jun 2011 11:30:22 +0000 (07:30 -0400)
engine/lib/views.php
views/default/page/layouts/content/header.php

index 7358fc0ba755e0356853ae4884e85cd76a2d3657..aff0dbd0d6e1146a3cde863dbc7ebec5a0784c3b 100644 (file)
@@ -1076,21 +1076,24 @@ function elgg_view_entity_annotations(ElggEntity $entity, $full_view = true) {
 }
 
 /**
- * Returns a rendered title.
+ * Renders a title.
  *
  * This is a shortcut for {@elgg_view page/elements/title}.
  *
- * @param string $title   The page title
- * @param string $submenu Should a submenu be displayed? (deprecated)
+ * @param string $title The page title
+ * @param string $vars  View variables (was submenu be displayed? (deprecated))
  *
  * @return string The HTML (etc)
  */
-function elgg_view_title($title, $submenu = false) {
-       if ($submenu !== false) {
+function elgg_view_title($title, $vars = array()) {
+       if (!is_array($vars)) {
                elgg_deprecated_notice('setting $submenu in elgg_view_title() is deprecated', 1.8);
+               $vars = array('submenu' => $vars);
        }
 
-       return elgg_view('page/elements/title', array('title' => $title, 'submenu' => $submenu));
+       $vars['title'] = $title;
+
+       return elgg_view('page/elements/title', $vars);
 }
 
 /**
index 345163bdd659a3ef364d0640958826a06c7c66f4..1e66e52db6e1e65c94876c9f77197a402057a4e4 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Main content header
  *
- * This includes a title and a new content button by default
+ * Title and title menu
  *
  * @uses $vars['header_override'] HTML for overriding the default header (override)
  * @uses $vars['title']           Title text (override)
@@ -20,23 +20,24 @@ if (isset($vars['header_override'])) {
 }
 
 $context = elgg_extract('context', $vars, elgg_get_context());
-if ($context) {
-       $title = elgg_extract('title', $vars, '');
-       if (!$title) {
-               $title = elgg_echo($context);
-       }
 
-       if (isset($vars['buttons']) && $vars['buttons']) {
-               $buttons = $vars['buttons'];
-       } else {
-               $buttons = elgg_view_menu('title', array(
-                       'sort_by' => 'priority',
-                       'class' => 'elgg-menu-hz',
-               ));
-       }
-       echo <<<HTML
+$title = elgg_extract('title', $vars, '');
+if (!$title) {
+       $title = elgg_echo($context);
+}
+$title = elgg_view_title($title, array('class' => 'elgg-heading-main'));
+
+if (isset($vars['buttons']) && $vars['buttons']) {
+       $buttons = $vars['buttons'];
+} else {
+       $buttons = elgg_view_menu('title', array(
+               'sort_by' => 'priority',
+               'class' => 'elgg-menu-hz',
+       ));
+}
+
+echo <<<HTML
 <div class="elgg-head clearfix">
-       <h2 class="elgg-heading-main">$title</h2>$buttons
+       $title$buttons
 </div>
 HTML;
-}