Skip to content

Firefly III: a personal finances manager

Make it easier to switch between v1/v2 layout.

James Coleb8340ddb5916
diff --git a/bootstrap/app.php b/bootstrap/app.php
index 10cb63c83b..f7a7e500df 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -83,19 +83,22 @@ if (!function_exists('prefixView')) {
if (func_num_args() === 0) {
return $factory;
}
+ // original view:
$prefixView = $view;
- if (
- true === env('APP_DEBUG', false)
- && null !== $view
- && is_string($view)) {
- // do something with view:
+
+ // try to find the view file first:
+ if(!$factory->exists($prefixView)) {
+ // prepend it with the view in the layout:
$layout = env('FIREFLY_III_LAYOUT', 'v1');
- $prefixView = sprintf('%s/%s', $layout, $view);
- if(false ===$factory->exists($prefixView)) {
- // fall back to v1.
- $prefixView = sprintf('%s/%s', 'v1', $view);
+ $prefixView = sprintf('%s.%s', $layout, $view);
+
+ // try again:
+ if(!$factory->exists($prefixView)) {
+ // if does not exist, force v1 and just continue.
+ $prefixView = sprintf('%s.%s', 'v1', $view);
}
}
+
return $factory->make($prefixView, $data, $mergeData);
}
}