-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathextend.php
52 lines (40 loc) · 1.7 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of fof/pages.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FoF\Pages;
use Flarum\Extend;
use FoF\Pages\Api\Controller;
return [
new Extend\Locales(__DIR__.'/resources/locale'),
(new Extend\Frontend('admin'))
->css(__DIR__.'/resources/less/admin.less')
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))
->css(__DIR__.'/resources/less/forum.less')
->js(__DIR__.'/js/dist/forum.js')
->route('/pages/home', 'pages.home')
->route('/p/{id:[\d\S]+(?:-[^/]*)?}', 'pages.page', Content\Page::class)
->content(Content\AddHomePageId::class),
(new Extend\Routes('api'))
->get('/pages', 'pages.index', Controller\ListPagesController::class)
->post('/pages', 'pages.create', Controller\CreatePageController::class)
->get('/pages/{id}', 'pages.show', Controller\ShowPageController::class)
->patch('/pages/{id}', 'pages.update', Controller\UpdatePageController::class)
->delete('/pages/{id}', 'pages.delete', Controller\DeletePageController::class),
(new Extend\View())
->namespace('fof-pages', __DIR__.'/resources/views'),
(new Extend\ModelVisibility(Page::class))
->scope(Access\ScopePageVisibility::class),
(new Extend\Filter(Search\PageFilterer::class))
->addFilter(Search\NoOpGambit::class),
(new Extend\SimpleFlarumSearch(Search\PageSearcher::class))
->setFullTextGambit(Search\NoOpGambit::class),
(new Extend\ServiceProvider())
->register(Providers\PageServiceProvider::class),
];