-
Notifications
You must be signed in to change notification settings - Fork 351
Add XmlTemplateFormMetadataLoader to replace old structure based metadata loading #7982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add XmlTemplateFormMetadataLoader to replace old structure based metadata loading #7982
Conversation
@@ -275,7 +275,7 @@ public function prependExtension(ContainerConfigurator $container, ContainerBuil | |||
], | |||
], | |||
'templates' => [ | |||
'articles' => [ | |||
ArticleInterface::TEMPLATE_TYPE => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally would remove the "template_type" currently singleton (page, snippet, article) and replace it with the resource key (pages, snippets, articles) but that should be discussed and tackled in an own Pull request.
4fac69f
to
f37b7ad
Compare
$container->prependExtensionConfig( | ||
'sulu_admin', | ||
[ | ||
'templates' => [ | ||
'block' => [ // TODO maybe blocks? | ||
'default_type' => null, | ||
'directories' => [ | ||
'app' => '%kernel.project_dir%/config/templates/blocks', | ||
], | ||
], | ||
], | ||
] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should move this in to the admin or content bundle not sure. Little bit splitted what the correct place is. /cc @Prokyonn, @chirimoya.
JS for global blocks is in the Admin Bundle. Metadata currently also. Template types definitions are in the specific bundles (articles, snippets, page).
Global Metadata service is currently in component would also required to move to the bundle which does the configuration.
Block json metadata which also handles global blocks is currently part of the block content type currently inside components. The block property resolver will be part of content bundle, the json metadata maybe also but would not be required, currently property resolver interface and json schema interfaces are on the same class.
- https://github.com/sulu/sulu/blob/3.0/src/Sulu/Component/Content/Types/BlockContentType.php#L471-L505
- https://github.com/sulu/sulu/blob/3.0/src/Sulu/Component/Content/Types/Metadata/GlobalBlocksTypedFormMetadataVisitor.php
'blocks' => [ 'path' => '%kernel.project_dir%/config/templates/blocks', 'type' => 'block', ],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut feeling says contentBundle, but I cannot tell you a specific reason for it 😅, both cases are valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay lets tackle this in own PR my first indention was also content, thomas also, but discussion is will it be used outside of content bundle then it would be better to stay part of admin.
@@ -390,7 +390,7 @@ private function getTypes(): array | |||
$metadata = $this->formMetadataProvider->getMetadata('page', $user->getLocale(), []); | |||
|
|||
foreach ($metadata->getForms() as $form) { | |||
$types[] = ['type' => $form->getName(), 'title' => $form->getTitle($user->getLocale())]; | |||
$types[] = ['type' => $form->getKey(), 'title' => $form->getTitle($user->getLocale())]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of confused about name
and key
in forms vs templates @Prokyonn lets discuss this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tackled in #7984
f37b7ad
to
e50f7b2
Compare
e50f7b2
to
e2eaaff
Compare
<!-- | ||
<tag name="sulu_admin.form_metadata_loader"/> | ||
--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently commented out but whole service should later be removed in upcoming PR with removing the structure metadata.
This PR responsibility is just replace all usage of metadata of the admin is not longer build on top of structure metadata instead using the new parsers of the admin bundle.
5b97a69
to
e2d388b
Compare
e2d388b
to
4c9bdf8
Compare
@@ -270,7 +270,7 @@ | |||
"required": false, | |||
"multilingual": true, | |||
"spaceAfter": null, | |||
"minOccurs": null, | |||
"minOccurs": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO need to find out where this regression comes from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually 0 is the correct value here:
sulu/src/Sulu/Bundle/AdminBundle/Tests/Application/config/templates/pages/default.xml
Line 95 in 2bb3242
<block name="blocks" default-type="text_block2" minOccurs="0"> |
Shold we convert 0 to null or keep it as it is now? /cc @Prokyonn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping it like this is more transparent
ee7b323
to
29c1e56
Compare
/** | ||
* @internal | ||
*/ | ||
class BlockSettingsFormMetadataVisitor implements TypedFormMetadataVisitorInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied from StructureFormMetadataLoader
which will get removed in upcoming PR
'templates' => [ | ||
PageInterface::TEMPLATE_TYPE => [ | ||
'directories' => [ | ||
'app' => '%kernel.project_dir%/config/templates/pages', | ||
], | ||
], | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required currently also in the old page bundle as the new one is not registered yet in old other bundles because conflicts with the old one
e3aa8df
to
a0206cd
Compare
1c62983
to
73ca91d
Compare
73ca91d
to
1805f85
Compare
@@ -270,7 +270,7 @@ | |||
"required": false, | |||
"multilingual": true, | |||
"spaceAfter": null, | |||
"minOccurs": null, | |||
"minOccurs": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping it like this is more transparent
$container->prependExtensionConfig( | ||
'sulu_admin', | ||
[ | ||
'templates' => [ | ||
'block' => [ // TODO maybe blocks? | ||
'default_type' => null, | ||
'directories' => [ | ||
'app' => '%kernel.project_dir%/config/templates/blocks', | ||
], | ||
], | ||
], | ||
] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut feeling says contentBundle, but I cannot tell you a specific reason for it 😅, both cases are valid
8d29c51
to
10bc922
Compare
What's in this PR?
Add new XmlTemplateFormMetadataLoader.
Why?
To replace old structure based metadata loading.
ToDo