-
Notifications
You must be signed in to change notification settings - Fork 326
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 global block types #7229
Add global block types #7229
Conversation
1552282
to
e010abd
Compare
It was that easy? :D But as for the implemetation, I'd suggest using a different tag name for this. This will then also allow us to expand this to other stuff as well. |
7cd6b9a
to
2a73baf
Compare
Just tried this out in the dev environment only globalizing one block (or biggest content block) and these are the results:
PS: The measurements are done with beautified json so most of the config is tabs or spaces. |
2a73baf
to
5359c30
Compare
i would suggest as the configuration:
which means that the reference is always a global block and without a name the name will be used by the global block but this name can be overwritten in the tag by adding a name attribute. |
Additionally is this not only a thing of of the block content type. We could also use it for other types which uses the types/type definition (image_map) for example. But then the name "global-block" does not match anymore. I would suggest to rename this feature to "global-type". which is nearer a naming where it is used |
@alexander-schranz @chirimoya we have to discuss the open points next week |
@mamazu i have finalized the implementation (added the validation) and also changed the configuration a bit! can you maybe test again this branch? |
src/Sulu/Bundle/AdminBundle/Resources/js/containers/Form/stores/metadataStore.js
Show resolved
Hide resolved
2d4ec9a
to
b531fa5
Compare
Well, one thing I found out during the testing is that you can not have
Code: <?xml version="1.0" ?>
<properties xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd"
>
<block name="blocks" default-type="flexbox_row">
<types>
<type name="flexbox_row">
<meta>
<title>Flexbox row</title>
</meta>
<properties>
<xi:include href="../blocks/fragments/padding_responsive.xml" xpointer="xmlns(sulu=http://schemas.sulu.io/template/template)xpointer(/sulu:properties/sulu:section)"/>
<property name="full_container" type="checkbox" colspan="4">
<meta>
<title>Full flexbox row container</title>
</meta>
<params>
<param name="type" value="checkbox"/>
</params>
</property>
<property name="collapse_margin" type="checkbox" colspan="4">
<meta>
<title>Collapse margin</title>
</meta>
<params>
<param name="type" value="checkbox"/>
</params>
</property>
<property name="color" type="color" colspan="4">
<meta>
<title>ui.color</title>
</meta>
</property>
<block name="flex_box" default-type="flex_box_block">
<xi:include href="../blocks/misc/flex_box_types.xml" xpointer="xmlns(sulu=http://schemas.sulu.io/template/template)xpointer(/sulu:properties/sulu:block/sulu:types)"/>
</block>
</properties>
</type>
</types>
</block>
</properties> |
@mamazu The example looks unexpected from my point of view. I did not have a deeper look yet at this implementation but my expection is that a new block type inside <?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">
<key>flexbox_row</key>
<meta>
<title lang="en">Flexbox Row</title>
<title lang="de">Flexbox Reihe</title>
</meta>
<properties>
<xi:include href="../blocks/fragments/padding_responsive.xml" xpointer="xmlns(sulu=http://schemas.sulu.io/template/template)xpointer(/sulu:properties/sulu:section)"/>
<property name="full_container" type="checkbox" colspan="4">
<meta>
<title>Full flexbox row container</title>
</meta>
<params>
<param name="type" value="checkbox"/>
</params>
</property>
<property name="collapse_margin" type="checkbox" colspan="4">
<meta>
<title>Collapse margin</title>
</meta>
<params>
<param name="type" value="checkbox"/>
</params>
</property>
<property name="color" type="color" colspan="4">
<meta>
<title>ui.color</title>
</meta>
</property>
<block name="flex_box" default-type="flex_box_block">
<xi:include href="../blocks/misc/flex_box_types.xml" xpointer="xmlns(sulu=http://schemas.sulu.io/template/template)xpointer(/sulu:properties/sulu:block/sulu:types)"/>
</block>
</properties>
</template> Where xincludes should work the same as for articles and snippets already as metadata should still be loaded the same way. |
But with @alexander-schranz code I get a different error:
|
The example looks like that your Like in the sulu demo I recommend you to move the xincluded xmls to something like https://github.com/sulu/sulu-demo/tree/master/config/templates Still there could be an error with that visitor. |
b531fa5
to
ceb35df
Compare
@mamazu yes there was an issue with the visitor. I think you have a section somewhere in the template! I have not tested it with it. But the last push should fix that. // cc @alexander-schranz |
f1c41df
to
219fe99
Compare
@alexander-schranz this is ready now :) |
@chirimoya will do the review here. |
Looks good from my side too. |
219fe99
to
9d174eb
Compare
src/Sulu/Component/Content/Compat/Structure/LegacyPropertyFactory.php
Outdated
Show resolved
Hide resolved
16bd691
to
21e7a12
Compare
21e7a12
to
b457d24
Compare
What's in this PR?
Global block types handling
Why?
Reduces size of block structure metadata and make it easier to reuse block structures.
Example Usage
To Do
To Disucuss