1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Lichtenwallner (https://lichtenwallner.at) |
4
|
|
|
* |
5
|
|
|
* @see https://github.com/jolicht/markdown-cms for the canonical source repository |
6
|
|
|
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT |
7
|
|
|
* @copyright Copyright (c) Johannes Lichtenwallner |
8
|
|
|
*/ |
9
|
|
|
declare(strict_types = 1); |
10
|
|
|
namespace Jolicht\MarkdownCms; |
11
|
|
|
|
12
|
|
|
use Mni\FrontYAML\Parser; |
13
|
|
|
use Jolicht\MarkdownCms\Markdown\FrontYamlParserFactory; |
14
|
|
|
use Jolicht\MarkdownCms\Markdown\MarkdownDocumentParser; |
15
|
|
|
use Jolicht\MarkdownCms\Markdown\MarkdownDocumentParserFactory; |
16
|
|
|
use Jolicht\MarkdownCms\ContentType\PageCreator; |
17
|
|
|
use Jolicht\MarkdownCms\ContentType\BlogEntryCreator; |
18
|
|
|
use Jolicht\MarkdownCms\Iterator\MarkdownFileIterator; |
19
|
|
|
use Jolicht\MarkdownCms\Iterator\MarkdownFileIteratorFactory; |
20
|
|
|
use Jolicht\MarkdownCms\ContentType\ContentCreator; |
21
|
|
|
use Jolicht\MarkdownCms\ContentType\ContentCreatorFactory; |
22
|
|
|
use Jolicht\MarkdownCms\Parser\ContentParser; |
23
|
|
|
use Jolicht\MarkdownCms\Parser\ContentParserFactory; |
24
|
|
|
use Jolicht\MarkdownCms\Parser\ParseContentExecutor; |
25
|
|
|
use Jolicht\MarkdownCms\Parser\ParseContentExecutorFactory; |
26
|
|
|
use Jolicht\MarkdownCms\Parser\Observer\SaveContentConfigObserver; |
27
|
|
|
use Jolicht\MarkdownCms\Parser\Observer\SaveContentConfigObserverFactory; |
28
|
|
|
use Jolicht\MarkdownCms\Command\ParseContentCommand; |
29
|
|
|
use Jolicht\MarkdownCms\Command\ParseContentCommandFactory; |
30
|
|
|
use Jolicht\MarkdownCms\Action\SingleBlogEntryAction; |
31
|
|
|
use Jolicht\MarkdownCms\Action\SingleBlogEntryActionFactory; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Configuration provider for module Jolicht\MarkdownCms |
35
|
|
|
*/ |
36
|
|
|
class ModuleConfig |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* Get module config |
40
|
|
|
*/ |
41
|
|
|
public function __invoke() |
42
|
|
|
{ |
43
|
|
|
return [ |
44
|
|
|
'markdown_cms' => [ |
45
|
|
|
'options' => [ |
46
|
|
|
'content_dir' => 'data/content', |
47
|
|
|
'content_config_path' => 'config/autoload/markdown-cms.global.php', |
48
|
|
|
'content_type_default' => 'blogEntry', |
49
|
|
|
'parse_content_executor' => [ |
50
|
|
|
'observers' => [ |
51
|
|
|
'save_content_config' => SaveContentConfigObserver::class, |
52
|
|
|
] |
53
|
|
|
], |
54
|
|
|
'content_types' => [ |
55
|
|
|
'page' => [ |
56
|
|
|
'creator' => PageCreator::class, |
57
|
|
|
'default_template' => 'app::page.twig' |
58
|
|
|
], |
59
|
|
|
'blogEntry' => [ |
60
|
|
|
'creator' => BlogEntryCreator::class, |
61
|
|
|
'default_template' => 'app::blog-entry.twig' |
62
|
|
|
] |
63
|
|
|
] |
64
|
|
|
] |
65
|
|
|
], |
66
|
|
|
'dependencies' => [ |
67
|
|
|
'factories' => [ |
68
|
|
|
ContentCreator::class => ContentCreatorFactory::class, |
69
|
|
|
ContentParser::class => ContentParserFactory::class, |
70
|
|
|
MarkdownDocumentParser::class => MarkdownDocumentParserFactory::class, |
71
|
|
|
MarkdownFileIterator::class => MarkdownFileIteratorFactory::class, |
72
|
|
|
Parser::class => FrontYamlParserFactory::class, |
73
|
|
|
ParseContentCommand::class => ParseContentCommandFactory::class, |
74
|
|
|
ParseContentExecutor::class => ParseContentExecutorFactory::class, |
75
|
|
|
SaveContentConfigObserver::class => SaveContentConfigObserverFactory::class, |
76
|
|
|
SingleBlogEntryAction::class => SingleBlogEntryActionFactory::class, |
77
|
|
|
] |
78
|
|
|
], |
79
|
|
|
'routes' => [ |
80
|
|
|
'markdown_cms:blog' => [ |
81
|
|
|
'name' => 'blog', |
82
|
|
|
'path' => '/blog.{id:[^/]+}.html', |
83
|
|
|
'middleware' => SingleBlogEntryAction::class, |
84
|
|
|
'allowed_methods' => [ |
85
|
|
|
'GET' |
86
|
|
|
] |
87
|
|
|
], |
88
|
|
|
'markdown_cms:pages' => [ |
89
|
|
|
'name' => 'pages', |
90
|
|
|
'path' => '/{id}.html', |
91
|
|
|
'middleware' => SingleBlogEntryAction::class, |
92
|
|
|
'allowed_methods' => [ |
93
|
|
|
'GET' |
94
|
|
|
] |
95
|
|
|
] |
96
|
|
|
], |
97
|
|
|
]; |
98
|
|
|
} |
99
|
|
|
} |