|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Monsieur Biz' Rich Editor plugin for Sylius. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Monsieur Biz <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace MonsieurBiz\SyliusRichEditorPlugin\DependencyInjection; |
|
15
|
|
|
|
|
16
|
|
|
use MonsieurBiz\SyliusRichEditorPlugin\UiElement\UiElement; |
|
17
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
|
18
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
19
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
20
|
|
|
|
|
21
|
|
|
final class Configuration implements ConfigurationInterface |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* {@inheritdoc} |
|
25
|
|
|
*/ |
|
26
|
|
|
public function getConfigTreeBuilder(): TreeBuilder |
|
27
|
|
|
{ |
|
28
|
|
|
$treeBuilder = new TreeBuilder('monsieurbiz_sylius_richeditor'); |
|
29
|
|
|
if (method_exists($treeBuilder, 'getRootNode')) { |
|
30
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
|
31
|
|
|
} else { |
|
32
|
|
|
// BC layer for symfony/config 4.1 and older |
|
33
|
|
|
$rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('monsieurbiz_sylius_richeditor'); |
|
|
|
|
|
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
$this->addUiElements($rootNode); |
|
37
|
|
|
|
|
38
|
|
|
return $treeBuilder; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param ArrayNodeDefinition $rootNode |
|
43
|
|
|
*/ |
|
44
|
|
|
private function addUiElements(ArrayNodeDefinition $rootNode): void |
|
45
|
|
|
{ |
|
46
|
|
|
/** @scrutinizer ignore-call */ |
|
47
|
|
|
$rootNode |
|
48
|
|
|
->children() |
|
49
|
|
|
->scalarNode('upload_directory')->end() |
|
50
|
|
|
->scalarNode('image_upload_directory')->end() |
|
51
|
|
|
->scalarNode('default_element')->defaultValue('monsieurbiz.html')->end() |
|
52
|
|
|
->scalarNode('default_element_data_field')->defaultValue('content')->end() |
|
53
|
|
|
->arrayNode('ui_elements') |
|
54
|
|
|
->useAttributeAsKey('code', false) |
|
55
|
|
|
->defaultValue([]) |
|
56
|
|
|
->arrayPrototype() |
|
57
|
|
|
->children() |
|
58
|
|
|
->scalarNode('title')->isRequired()->cannotBeEmpty()->end() |
|
59
|
|
|
->scalarNode('description')->isRequired()->cannotBeEmpty()->end() |
|
60
|
|
|
->scalarNode('alias')->end() |
|
61
|
|
|
->scalarNode('icon')->isRequired()->cannotBeEmpty()->end() |
|
62
|
|
|
->booleanNode('enabled')->defaultTrue()->end() |
|
63
|
|
|
->arrayNode('classes') |
|
64
|
|
|
->addDefaultsIfNotSet() |
|
65
|
|
|
->children() |
|
66
|
|
|
->scalarNode('form')->isRequired()->cannotBeEmpty()->end() |
|
67
|
|
|
->scalarNode('ui_element')->defaultValue(UiElement::class)->end() |
|
68
|
|
|
->end() |
|
69
|
|
|
->end() |
|
70
|
|
|
->arrayNode('templates') |
|
71
|
|
|
->addDefaultsIfNotSet() |
|
72
|
|
|
->children() |
|
73
|
|
|
->scalarNode('admin_form') |
|
74
|
|
|
->defaultValue('@MonsieurBizSyliusRichEditorPlugin/Admin/form.html.twig') |
|
75
|
|
|
->end() |
|
76
|
|
|
->scalarNode('admin_render')->isRequired()->cannotBeEmpty()->end() |
|
77
|
|
|
->scalarNode('front_render')->isRequired()->cannotBeEmpty()->end() |
|
78
|
|
|
->end() |
|
79
|
|
|
->end() |
|
80
|
|
|
->arrayNode('tags') |
|
81
|
|
|
->defaultValue([]) |
|
82
|
|
|
->scalarPrototype()->end() |
|
83
|
|
|
->end() |
|
84
|
|
|
->end() |
|
85
|
|
|
->end() |
|
86
|
|
|
->end() |
|
87
|
|
|
->end() |
|
88
|
|
|
->end() |
|
89
|
|
|
; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.