-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.php
More file actions
67 lines (57 loc) · 1.76 KB
/
kernel.php
File metadata and controls
67 lines (57 loc) · 1.76 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php namespace TapestryCloud;
use Tapestry\Entities\Configuration;
use Tapestry\Modules\Kernel\KernelInterface;
use Tapestry\Plates\Engine;
use Tapestry\Tapestry;
class Kernel implements KernelInterface
{
/**
* @var Tapestry
*/
private $tapestry;
/**
* @var Engine
*/
private $engine;
private $container;
public function __construct(Tapestry $tapestry)
{
$this->tapestry = $tapestry;
$this->container = $tapestry->getContainer();
$this->engine = $this->container->get(Engine::class);
}
/**
* This method is executed by Tapestry when the Kernel is registered.
*
* @return void
*/
public function register()
{
// Use project autoloader
require_once(__DIR__ . '/vendor/autoload.php');
}
/**
* This method of executed by Tapestry as part of the build process.
*
* @return void
*/
public function boot()
{
$this->engine->loadExtension($this->container->get(TestPlatesExtension::class));
$this->tapestry->register(\TapestryCloud\Asset\ServiceProvider::class);
$this->tapestry->register(\TapestryCloud\CodeExample\ServiceProvider::class);
// Inverse the documentation menu for breadcrumb lookup
/** @var Configuration $config */
$config = $this->container->get(Configuration::class);
$arr = [];
foreach ($config->get('site.documentation-menu', []) as $parent => $children) {
foreach ($children as $child => $item) {
$arr[base64_encode(url($item))] = [
$parent,
$child
];
}
}
$config->set('site.documentation-menu-breadcrumb-lookup', $arr);
}
}