Use new extenders for bootstrapping

This commit is contained in:
Franz Liedke 2018-01-03 08:00:00 +01:00
parent 30cbe76643
commit 3b030db173
3 changed files with 21 additions and 58 deletions

View File

@ -9,9 +9,25 @@
* file that was distributed with this source code.
*/
use Flarum\BBCode\Listener;
use Illuminate\Contracts\Events\Dispatcher;
use Flarum\Extend;
use s9e\TextFormatter\Configurator;
return function (Dispatcher $events) {
$events->subscribe(Listener\FormatBBCode::class);
};
return [
new Extend\FormatterConfiguration(function (Configurator $config) {
$config->BBCodes->addFromRepository('B');
$config->BBCodes->addFromRepository('I');
$config->BBCodes->addFromRepository('U');
$config->BBCodes->addFromRepository('S');
$config->BBCodes->addFromRepository('URL');
$config->BBCodes->addFromRepository('IMG');
$config->BBCodes->addFromRepository('EMAIL');
$config->BBCodes->addFromRepository('CODE');
$config->BBCodes->addFromRepository('QUOTE');
$config->BBCodes->addFromRepository('LIST');
$config->BBCodes->addFromRepository('DEL');
$config->BBCodes->addFromRepository('COLOR');
$config->BBCodes->addFromRepository('CENTER');
$config->BBCodes->addFromRepository('SIZE');
$config->BBCodes->addFromRepository('*');
})
];

View File

@ -17,11 +17,6 @@
"require": {
"flarum/core": "^0.1.0-beta.6"
},
"autoload": {
"psr-4": {
"Flarum\\BBCode\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"

View File

@ -1,48 +0,0 @@
<?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.
*/
namespace Flarum\BBCode\Listener;
use Flarum\Formatter\Event\Configuring;
use Illuminate\Contracts\Events\Dispatcher;
class FormatBBCode
{
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(Configuring::class, [$this, 'addBBCodeFormatter']);
}
/**
* @param Configuring $event
*/
public function addBBCodeFormatter(Configuring $event)
{
$event->configurator->BBCodes->addFromRepository('B');
$event->configurator->BBCodes->addFromRepository('I');
$event->configurator->BBCodes->addFromRepository('U');
$event->configurator->BBCodes->addFromRepository('S');
$event->configurator->BBCodes->addFromRepository('URL');
$event->configurator->BBCodes->addFromRepository('IMG');
$event->configurator->BBCodes->addFromRepository('EMAIL');
$event->configurator->BBCodes->addFromRepository('CODE');
$event->configurator->BBCodes->addFromRepository('QUOTE');
$event->configurator->BBCodes->addFromRepository('LIST');
$event->configurator->BBCodes->addFromRepository('DEL');
$event->configurator->BBCodes->addFromRepository('COLOR');
$event->configurator->BBCodes->addFromRepository('CENTER');
$event->configurator->BBCodes->addFromRepository('SIZE');
$event->configurator->BBCodes->addFromRepository('*');
}
}