Hi All,
I used this section of code previously in extend.php
meaning I could have a longer post title etc
// 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);
}
});
}),
This no longer seems to work in Flarum 1.x, and throws an error. Is there any replacement ? It seems extend\compat
is where things fall over with the below
PHP Fatal error: Uncaught Error: Class 'Flarum\Extend\Compat' not found in /home/metabullet/public_html/extend.php:28
Stack trace:
#0 /home/metabullet/public_html/vendor/flarum/core/src/Foundation/Site.php(65): require()
#1 /home/metabullet/public_html/vendor/flarum/core/src/Foundation/Site.php(38): Flarum\Foundation\Site::loadExtenders()
#2 /home/metabullet/public_html/site.php(47): Flarum\Foundation\Site::fromPaths()
#3 /home/metabullet/public_html/flarum(11): require('/home/metabulle...')
#4 {main}
thrown in /home/metabullet/public_html/extend.php on line 28