Skip to content

Commit 6c5c12a

Browse files
committed
Use a fallback for default themes views
Now if themes don’t have a « view » folder, a fallback will load the default views in FeatherBB core. Otherwise, views will be overwritten by the current theme. Of course, themes have to use the same architecture as the default views folder.
1 parent 2d929d5 commit 6c5c12a

File tree

155 files changed

+5
-7329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+5
-7329
lines changed

featherbb/Controller/Install.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
namespace FeatherBB\Controller;
1111

12-
use FeatherBB\Core\Random;
1312
use FeatherBB\Core\Url;
1413
use FeatherBB\Core\Utils;
14+
use FeatherBB\Core\Random;
15+
use FeatherBB\Middleware\Core;
1516

1617
class Install
1718
{
@@ -165,7 +166,7 @@ public function create_config(array $data)
165166

166167
public function create_db(array $data)
167168
{
168-
\FeatherBB\Core::init_db($data);
169+
Core::init_db($data);
169170

170171
// Load appropriate language
171172
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$data['default_lang'].'/install.mo');

featherbb/Core/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getTemplatePathname($file)
194194
{
195195
$pathname = $this->templatesDirectory . DIRECTORY_SEPARATOR . ltrim($file, DIRECTORY_SEPARATOR);
196196
if (!is_file($pathname)) {
197-
$pathname = $this->app->forum_env['FEATHER_ROOT'] . 'view/' . ltrim($file, DIRECTORY_SEPARATOR); // Fallback on default view
197+
$pathname = $this->app->forum_env['FEATHER_ROOT'] . 'featherbb/View/' . ltrim($file, DIRECTORY_SEPARATOR); // Fallback on default view
198198
if (!is_file($pathname)) {
199199
throw new \RuntimeException("View cannot add template `$file` to stack because the template does not exist");
200200
}
@@ -251,7 +251,7 @@ protected function render($data = null, $nested = true)
251251

252252
public function setStyle($style)
253253
{
254-
if (!is_dir($this->app->forum_env['FEATHER_ROOT'].'style/themes/'.$style.'/view/')) {
254+
if (!is_dir($this->app->forum_env['FEATHER_ROOT'].'style/themes/'.$style.'/')) {
255255
throw new \InvalidArgumentException('The style '.$style.' doesn\'t exist');
256256
}
257257
$this->data->set('style', (string) $style);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)