|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Hyde\Framework; |
|
6
|
|
|
|
|
7
|
|
|
use Hyde\Facades\Features; |
|
8
|
|
|
use Hyde\Foundation\HydeKernel; |
|
9
|
|
|
use Hyde\Framework\Concerns\RegistersFileLocations; |
|
10
|
|
|
use Hyde\Framework\Services\AssetService; |
|
11
|
|
|
use Hyde\Pages\BladePage; |
|
12
|
|
|
use Hyde\Pages\DocumentationPage; |
|
13
|
|
|
use Hyde\Pages\HtmlPage; |
|
14
|
|
|
use Hyde\Pages\MarkdownPage; |
|
15
|
|
|
use Hyde\Pages\MarkdownPost; |
|
16
|
|
|
use Illuminate\Support\ServiceProvider; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Register and bootstrap core Hyde application services. |
|
20
|
|
|
*/ |
|
21
|
|
|
class HydeServiceProvider extends ServiceProvider |
|
22
|
|
|
{ |
|
23
|
|
|
use RegistersFileLocations; |
|
24
|
|
|
|
|
25
|
|
|
protected HydeKernel $kernel; |
|
26
|
|
|
|
|
27
|
|
|
public function register(): void |
|
28
|
|
|
{ |
|
29
|
|
|
$this->kernel = HydeKernel::getInstance(); |
|
30
|
|
|
|
|
31
|
|
|
$this->app->singleton(AssetService::class, AssetService::class); |
|
32
|
|
|
|
|
33
|
|
|
$this->kernel->setSourceRoot(config('hyde.source_root', '')); |
|
34
|
|
|
|
|
35
|
|
|
$this->registerPageModels(); |
|
36
|
|
|
|
|
37
|
|
|
$this->registerSourceDirectories([ |
|
38
|
|
|
HtmlPage::class => '_pages', |
|
39
|
|
|
BladePage::class => '_pages', |
|
40
|
|
|
MarkdownPage::class => '_pages', |
|
41
|
|
|
MarkdownPost::class => '_posts', |
|
42
|
|
|
DocumentationPage::class => '_docs', |
|
43
|
|
|
]); |
|
44
|
|
|
|
|
45
|
|
|
$this->registerOutputDirectories([ |
|
46
|
|
|
HtmlPage::class => '', |
|
47
|
|
|
BladePage::class => '', |
|
48
|
|
|
MarkdownPage::class => '', |
|
49
|
|
|
MarkdownPost::class => 'posts', |
|
50
|
|
|
DocumentationPage::class => config('docs.output_directory', 'docs'), |
|
51
|
|
|
]); |
|
52
|
|
|
|
|
53
|
|
|
$this->storeCompiledSiteIn(config('site.output_directory', '_site')); |
|
54
|
|
|
|
|
55
|
|
|
$this->useMediaDirectory(config('site.media_directory', '_media')); |
|
56
|
|
|
|
|
57
|
|
|
$this->discoverBladeViewsIn(BladePage::sourceDirectory()); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function boot(): void |
|
61
|
|
|
{ |
|
62
|
|
|
$this->kernel->readyToBoot(); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
protected function registerPageModels(): void |
|
66
|
|
|
{ |
|
67
|
|
|
if (Features::hasHtmlPages()) { |
|
68
|
|
|
$this->kernel->registerPageClass(HtmlPage::class); |
|
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
if (Features::hasBladePages()) { |
|
72
|
|
|
$this->kernel->registerPageClass(BladePage::class); |
|
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
if (Features::hasMarkdownPages()) { |
|
76
|
|
|
$this->kernel->registerPageClass(MarkdownPage::class); |
|
|
|
|
|
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
if (Features::hasMarkdownPosts()) { |
|
80
|
|
|
$this->kernel->registerPageClass(MarkdownPost::class); |
|
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
if (Features::hasDocumentationPages()) { |
|
84
|
|
|
$this->kernel->registerPageClass(DocumentationPage::class); |
|
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.