aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 379c4e543..8f3196482 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -228,10 +228,11 @@
* @param string $view The name and location of the view to use
* @param array $vars Any variables that the view requires, passed as an array
* @param boolean $bypass If set to true, elgg_view will bypass any specified alternative template handler; by default, it will hand off to this if requested (see set_template_handler)
- * @param boolean $debug If set to true, the viewer will complain if it can't find a view
+ * @param boolean $debug If set to true, the viewer will complain if it can't find a view
+ * @param string $viewtype If set, forces the viewtype for the elgg_view call to be this value (default: standard detection)
* @return string The HTML content
*/
- function elgg_view($view, $vars = "", $bypass = false, $debug = false) {
+ function elgg_view($view, $vars = "", $bypass = false, $debug = false, $viewtype = '') {
global $CONFIG;
static $usercache;
@@ -286,8 +287,9 @@
}
- // Get the current viewtype
- $viewtype = elgg_get_viewtype();
+ // Get the current viewtype
+ if (empty($viewtype))
+ $viewtype = elgg_get_viewtype();
// Set up any extensions to the requested view
if (isset($CONFIG->views->extensions[$view])) {
@@ -313,7 +315,6 @@
foreach($viewlist as $priority => $view) {
$view_location = elgg_get_view_location($view);
-
if (file_exists($view_location . "{$viewtype}/{$view}.php") && !include($view_location . "{$viewtype}/{$view}.php")) {
$success = false;
@@ -352,15 +353,17 @@
/**
* Returns whether the specified view exists
*
- * @param string $view The view name
+ * @param string $view The view name
+ * @param string $viewtype If set, forces the viewtype
* @return true|false Depending on success
*/
- function elgg_view_exists($view) {
+ function elgg_view_exists($view, $viewtype = '') {
global $CONFIG;
- // Detect view type
- $viewtype = elgg_get_viewtype();
+ // Detect view type
+ if (empty($viewtype))
+ $viewtype = elgg_get_viewtype();
if (!isset($CONFIG->views->locations[$viewtype][$view])) {
if (!isset($CONFIG->viewpath)) {