-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
[PagepartBundle]: Possibility for nested pageparts #1174
Comments
from a quick look I guess the same functionality can be achieved, when the backend allows dynamic adding/removing regions. Is this correct? Is this functionality available already? |
ping @mlebkowski: I saw that you are already experienced with nesting forms - maybe you would have a hint for me about how to best achieve that. |
Can this be useful for your use case? |
@jockri: thanks for pointing this one out. I already thought about that, but as far as I understood all The only problem I have is, that I don't know how to do that? I have been googling around seeing some ideas of adding polymorphism to symfony's underlying form system - https://github.com/infinite-networks/InfiniteFormBundle - but I am not sure if this is not over the top and I really don't want to introduce the complexity of an additional bundle, to the already somewhat complex forms system. There is I guess also the possiblity to dynamically enhance the forms via Form Events: But I am not sure which route to go - maybe someone of Kunstmaan has the right hint what to do. Basically I think it is the same mechanism that you already implemented with "add a Pagepart" in a certain region of a page, but instead you add it as a child to a collection of a form. |
some more info on polymorphic collections can be found here: |
Yeah, I don’t think I can really help you, but I can give some suggestions. For starters, saving those entities would be done in a similar way that current page parts are — using a I don’t know the full requirements of your project, but it seems that it would be easier to add a Tab with regions configuration (this could be a simple nested form with a The system would consist of:
Does this seem right for you? |
@mlebkowski: Thanks a lot for your suggestions! After fiddling around with polycollection and not being very succesfull at adapting the pagepart system to the polycollection forms I started to create my own PageTemplate Parser/Reader to explore this idea. I managed to created Regions inside Regions, with this "pseudocode": /** class MyPageTemplateConfigurationParser extends PageTemplateConfigurationParser **/
...
public function parse($name) {
...
$rawData = [
'name' => 'Content page',
'template' => 'MyAppBundle::Pages\ContentPage\pagetemplate.html.twig',
'rows' => [
[
'regions' => [
[
'name' => 'main_left',
'span' => 4,
'regions' => [
[
'span' => 6,
'name' => 'main_left_sub1',
],
[
'span' => 6,
'name' => 'main_left_sub2',
]
],
],
[
'span' => 4,
'name' => 'main'
],
[
'span' => 4,
'name' => 'main_right'
]
]
]
]
]; I am succesfully displaying the following regions in the Backend-Admin:
But unfortunately I am already overwriting the Do you have any ideas on that? |
You’d like to have the |
I would like to have the |
Well, look into your template / renderer code. You must have some kind of condition on those sub-regions to display them instead of the main region. Anyway, this is your turf now, good luck ;) If I had to do it, I wouldn’t use columns for main regions (left / center / right), but rows instead. It would be cleaner for me this way:
|
@mlebkowski: Thanks a lot for your help you already pointed me in the right direction! I will try to debug the problem better. |
Actually I found the bug/feature now. The template that is delivered for You can alter this behaviour by rewriting the @mlebkowski: again, thanks a lot for your help. |
I managed to dynamically implement an arbitrary number of Rows/Regions per Page that are read out of the database by writing my own implementation of PagePartConfigurationReader and PagePartTemplateConfigurationReader. @mlebkowski: thanks for your PR #1109, without it this would not have been possible so easy. |
For a project I would need the possibility to nest pageparts within pageparts. Is this currently possible?
What I am trying to achieve is e.g. adding a two-column pagepart, where I have some pageparts in the first column and other pageparts in the second - or adding a three-column pagepart, where I can add different pageparts to the columns. Eventually there would be another way to do this (e.g. without nested pageparts). Any help would be appreciated.
The text was updated successfully, but these errors were encountered: