Related to my previous post about setting the theme configuration, this explains how you can force your forum logo without using the admin area.
Please note the following instructions are for the upcoming beta 8, but the same could be accomplished using a small custom/local extension.
If you want to force the Forum logo from your forum do the following:
/composer.json
allow additional code inside your Flarum installation root path:
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
Add this at the same level next to "require", I recommend above or below that key.
/app/Extend/ReplaceLogo.php
to create a custom extender for forcing the logo:
<?php
namespace App\Extend;
use Flarum\Extend\ExtenderInterface;
use Flarum\Extension\Extension;
use Illuminate\Contracts\Container\Container;
use Illuminate\View\View;
class ReplaceLogo implements ExtenderInterface
{
/**
* @var string
*/
private $path;
public function __construct(string $path)
{
$this->path = $path;
}
public function extend(Container $container, Extension $extension = null)
{
$container->extend('view', function ($view) {
$view->composer("*", function (View $view) {
$view->with('forum', ['logoUrl' => $this->path]);
});
return $view;
});
}
}
/extend.php
create an extend.php in your forum root (since beta 8)
<?php
namespace App;
use App\Extend as ExtendApp;
return [
(new ExtendApp\ReplaceLogo('/assets/logo.png')),
];
Store your logo at public/assets/logo.png
or change the path given in the above file.
Clear your cache:
$ php flarum cache:clear
From now on these configuration for your theme will be enforced no matter what value is being set in the admin. The above is active on the Flagrow forum.