www.gusucode.com > Flarum中文优化论坛PHP源码程序 > FlarumChina-master/vendor/flarum/flarum-ext-tags/src/Listener/AddClientAssets.php
<?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\Tags\Listener; use Flarum\Event\ConfigureClientView; use Flarum\Event\ConfigureForumRoutes; use Illuminate\Contracts\Events\Dispatcher; class AddClientAssets { /** * @param Dispatcher $events */ public function subscribe(Dispatcher $events) { $events->listen(ConfigureClientView::class, [$this, 'addAssets']); $events->listen(ConfigureForumRoutes::class, [$this, 'addRoutes']); } /** * @param ConfigureClientView $event */ public function addAssets(ConfigureClientView $event) { if ($event->isForum()) { $event->addAssets([ __DIR__.'/../../js/forum/dist/extension.js', __DIR__.'/../../less/forum/extension.less' ]); $event->addBootstrapper('flarum/tags/main'); } if ($event->isAdmin()) { $event->addAssets([ __DIR__.'/../../js/admin/dist/extension.js', __DIR__.'/../../less/admin/extension.less' ]); $event->addBootstrapper('flarum/tags/main'); } } /** * @param ConfigureForumRoutes $event */ public function addRoutes(ConfigureForumRoutes $event) { $event->get('/t/{slug}', 'tag'); $event->get('/tags', 'tags'); } }