-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
33 lines (27 loc) · 1.18 KB
/
index.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
<?php
use Kirby\Cms\App;
use Kirby\Filesystem\F;
F::loadClasses([
'JohannSchopplich\\Headless\\Api\\Api' => 'src/classes/Api/Api.php',
'JohannSchopplich\\Headless\\Api\\Middlewares' => 'src/classes/Api/Middlewares.php'
], __DIR__);
App::plugin('johannschopplich/headless', [
'hooks' => [
// Explicitly register catch-all routes only when Kirby and plugins
// have been loaded to ensure no other routes are overwritten
'system.loadPlugins:after' => function () {
$kirby = App::instance();
$extensions = [
'api' => require __DIR__ . '/src/extensions/api.php'
];
// Register global routes, if enabled
if ($kirby->option('headless.globalRoutes', false) === true) {
$extensions['routes'] = require __DIR__ . '/src/extensions/routes.php';
}
$kirby->extend($extensions, $kirby->plugin('johannschopplich/headless'));
}
],
'fieldMethods' => require __DIR__ . '/src/extensions/fieldMethods.php',
'pageMethods' => require __DIR__ . '/src/extensions/pageMethods.php',
'siteMethods' => require __DIR__ . '/src/extensions/siteMethods.php'
]);