diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/admin.php | 2 | ||||
-rw-r--r-- | engine/lib/tags.php | 3 | ||||
-rw-r--r-- | engine/lib/users.php | 12 | ||||
-rw-r--r-- | engine/lib/views.php | 57 | ||||
-rw-r--r-- | engine/tests/ui/submenu.php | 2 |
5 files changed, 39 insertions, 37 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 5a9e14498..2e2003bc8 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -211,7 +211,7 @@ function admin_settings_page_handler($page) { $content = "<div class=\"admin_notices\">$notices_html</div>$content"; } - $body = elgg_view_layout('administration', $content); + $body = elgg_view_layout('administration', array('content' => $content)); echo elgg_view_page($title, $body, 'page_shells/admin'); } diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 68cfee940..d5010118a 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -439,7 +439,8 @@ function elgg_tagcloud_page_handler($page) { default: $title = elgg_view_title(elgg_echo('tags:site_cloud')); $tags = display_tagcloud(0, 100, 'tags'); - $body = elgg_view_layout('one_column_with_sidebar', $title . $tags); + $content = $title . $tags; + $body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); break; diff --git a/engine/lib/users.php b/engine/lib/users.php index b3c21a0b5..b116e1083 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -984,7 +984,7 @@ function elgg_user_resetpassword_page_handler($page) { $title = elgg_echo('resetpassword'); $content = elgg_view_title(elgg_echo('resetpassword')) . $form; - echo elgg_view_page($title, elgg_view_layout('one_column', $content)); + echo elgg_view_page($title, elgg_view_layout('one_column', array('content' => $content))); } /** @@ -1332,13 +1332,9 @@ function registration_page_handler($page_elements) { * @todo finish */ function elgg_user_login_page_handler() { - $content = elgg_view_layout('one_column', elgg_view('account/login_box')); - $content = ' - <div id="elgg_content" class="clearfix"> - ' . elgg_view('account/login_box') . ' - </div> - '; - echo elgg_view_page('test', $content); + $login_box = elgg_view('account/login_box'); + $content = elgg_view_layout('one_column', array('content' => $login_box)); + echo elgg_view_page(elgg_echo('login'), $content); } /** diff --git a/engine/lib/views.php b/engine/lib/views.php index 459f84b69..24b25ffd0 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -916,38 +916,43 @@ function elgg_view_entity_annotations(ElggEntity $entity, $full = true) { /** * Displays a layout with optional parameters. * - * Layouts control the static elements in Elgg's appearance. + * Layouts provide consistent organization of pages and other blocks of content. * There are a few default layouts in core: - * - administration A special layout for the admin area. - * - one_column A single column page with a header and footer. - * - one_column_with_sidebar A single column page with a header, footer, and sidebar. - * - widgets A widget canvas. - * - * Arguments to this function are passed to the layouts as $area1, $area2, - * ... $areaN. See the individual layouts for what options are supported. - * - * Layouts are stored in canvas/layouts/$layout_name. - * - * @tip When calling this function, be sure to name the variable argument - * names as something meaningful. Avoid the habit of using $areaN as the - * argument names. - * - * @param string $layout The name of the views in canvas/layouts/. + * - administration A special layout for the admin area. + * - one_column A single content column. + * - one_column_with_sidebar A content column with sidebar. + * - widgets A widget canvas. + * + * The layout views take the form canvas/layouts/$layout_name + * See the individual layouts for what options are supported. The two most + * common layouts have these parameters: + * one_column + * content => string + * one_column_with_sidebar + * content => string + * sidebar => string (optional) + * + * @param string $layout The name of the view in canvas/layouts/. + * @param array $vars Associative array of parameters for the layout view * * @return string The layout - * @todo Make this consistent with the rest of the view functions by passing - * an array instead of "$areaN". */ -function elgg_view_layout($layout) { - $arg = 1; - $param_array = array(); - while ($arg < func_num_args()) { - $param_array['area' . $arg] = func_get_arg($arg); - $arg++; +function elgg_view_layout($layout_name, $vars = array()) { + + if (is_string($vars)) { + elgg_deprecated_notice("The use of unlimited optional string arguments in elgg_view_layout() was deprecated in favor of an options array", 1.8); + $arg = 1; + $param_array = array(); + while ($arg < func_num_args()) { + $param_array['area' . $arg] = func_get_arg($arg); + $arg++; + } + } else { + $param_array = $vars; } - if (elgg_view_exists("canvas/layouts/{$layout}")) { - return elgg_view("canvas/layouts/{$layout}", $param_array); + if (elgg_view_exists("canvas/layouts/{$layout_name}")) { + return elgg_view("canvas/layouts/{$layout_name}", $param_array); } else { return elgg_view("canvas/default", $param_array); } diff --git a/engine/tests/ui/submenu.php b/engine/tests/ui/submenu.php index 3069e7405..d5d188194 100644 --- a/engine/tests/ui/submenu.php +++ b/engine/tests/ui/submenu.php @@ -93,5 +93,5 @@ elgg_add_submenu_item(array('text' => 'All test', 'href' => "$url?all"), 'all'); //elgg_set_context('not_main'); -$body = elgg_view_layout('one_column_with_sidebar', 'Look right.'); +$body = elgg_view_layout('one_column_with_sidebar', array('content' => 'Look right.')); echo elgg_view_page('Submenu Test', $body); |