Circling back here, as the code I added to extend.php in the root of Flarum doesn't seem to work. Here's what I am using
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Extend;
use Flarum\Frontend\Document;
use Flarum\Foundation\Event\Validating;
use Flarum\Discussion\DiscussionValidator;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Support\Str;
return [
(new Extend\Frontend('forum'))
->content(function (Document $document) {
$document->meta['theme-color'] = '#12171a';
})
];
return [
// Register extenders here
new Extend\Compat(function(Dispatcher $events) {
$events->listen(Validating::class, function(Validating $event) {
if ($event->type instanceof DiscussionValidator) {
$rules = $event->validator->getRules();
$rules['title'] = array_map(function(string $rule) {
if (Str::startsWith($rule, 'max:')) {
return 'max:180';
}
return $rule;
}, $rules['title']);
$event->validator->setRules($rules);
}
});
}),
];
However, when using the API, some inserts are failing as the number of characters in the title exceeds 80. Is there a setting that targets the API specifically ?
Thanks