-
Notifications
You must be signed in to change notification settings - Fork 325
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
[BC Break] Sulu 2.6: Possible bug and/or documentation needed? How to migrate to new global blocks? #7409
Comments
Thx for the report maybe we can add a line to the UPGRADE.md. The If you did use it currently for xi:includes I recommend migrating to Migrating to global blocks is not a requirement for 2.6 sulu supports still local blocks and local block types. Some projects may not even have unique block names that they can easy migrate to global blocks. But beside the new reserved directory there is no change here required for the upgrade you can change the |
Thank you, also for the direct reaction with a Docs PR. That may help others to not spend hours on that surprising BC break. Is there a way to migrate existing content to the new global blocks? I like the idea behind that new architecture. |
The migration must be done manually sadly. Mostly just copy and paste. |
Sorry to open that again, but I now tried to add a new global block with a new name using the documented implementation and I still get that console error, when I want to edit any page:
Am I missing something here? Must the global blocks be registered or something? |
I have installed a new clone of sulu/skeleton and followed the example of globel blocks. I also get the same error message... |
@alexander-schranz can you open the issue again, as the second described problem seems to be not fixed? |
@spackmat the admin build wasu pdated to the latest version: https://docs.sulu.io/en/2.6/upgrades/upgrade-2.x.html#update-the-admin-javascript-build ? If you normally forget that your browser dev tools should show a warning at the very beginning of the sulu admin start. If I understand you only get the error in the frontend not in the @wachterjohannes do you have any idea what is causing the issue? |
Yes, i updated the js build multiple times. And yes, the error is in the browser-console. |
@ remdan can you share your test on a fresh skeleton? just push it as it is on a new repo and share it here! then we can take a look at it |
I have found a difference! the example works for me
but if I put this code in a Section it will break:
|
I think the problem is that type-refs inside of blocks don't work. I'm running into the same issue. |
I can confirm what @remdan said: In our case, the blocks were also included within a section. When I move them out of that section the error in the backend disappears. I consider this a bug as I expect the new global blocks to also work inside sections. Or maybe I've missed a deprecation for sections. Edit: Our blocks all had distinct names, so no content migration was needed at all. Just changing the definition to global block templates and using a type reference instead of an include (and not within a section!) already does the job. Maybe that could also be documented as a migration path for cases with already distinct named blocks. Besides fixing or at least documenting the bug with the sections. Edit2: Seems not to work with nested blocks. In the type list of the parent blocks I can see the referenced global types, but with their key (with its first letter uppercased) and not the name from the meta of the block template ( |
Hey, I patched my installation with the current version of #7423 (the one with two commits). Then I built the admin js and observed the following:
|
@spackmat i have done some changes in the merge-request! can you recheck and update your admin build? That should fix your empty forms in the admin |
@wachterjohannes I replaced my sulu/sulu dependency with your branch: Edit: Adding the repo works this way:
|
@spackmat this is really strange - have you also done a new an |
@wachterjohannes yes, Edit: Did it again, still the same. |
Both problems are fixed now with the latest commits in #7423. So this issue can be closed, when the PR is merged. |
Thanks for testing! |
Released in 2.6.2 |
Actual Behavior
After upgrading to Sulu 2.6 my included block types lead to different errors (on cache clear or in browser-console):
I have nested blocks that are all on their own xml-file. Like
blocks/block_text.xml
. Those aretype
elements with aname
attribute likename="block_text"
and they are included within thetypes
node of other templates via<xi:include href="blocks/block_text.xml"/>
. That worked well until Sulu 2.5:After upgrading to Sulu 2.6, I get an error on cache clear with that:
Interestingly, that error does not raise for elements (instead of blocks) that are defined and included the exact same way and it also does not raise, when I copy the type definition directly into its parent instead of including it via XInclude. This is my workaround for now.
Since the blocks have changed in Sulu 2.6 to global blocks, I then changed their definition according to the current documentation in https://docs.sulu.io/en/2.6/book/templates.html#using-global-blocks to the following code:
That removes the error on cache clear, but now, I cannot edit pages containing that block type any more. Instead I get the following error inside the browser console:
Adding an name-attribute to the ´type´ node with the
ref
leads to an xml error, as thatref
andname
are not allowed together.Expected Behavior
I expected either the old
xi:include
way to still work for included block types or the new global block handling to work with my existing content. Or at least a documented way to migrate my existing content to work with the new global blocks.Steps to Reproduce
Have a Sulu 2.5 instance with nested block based content using xi:include and upgrade to Sulu 2.6. We have two problems here: The first is the one with the new
xi:include
error for included block types and the other one that the needed migration for existing content that is not documented.Possible Solutions
I don't know how to solve that, but I guess that the existing content has to be migrated to be compatible to the new global block handling. Some documentation on how to do that would be helpful. Better would be to change the implementation in a way that no migration would be needed at all when the blocks keep their name.
For now, my workaround is to not include my block types via
xi:include
, but to copy their definitions directly into the templates using them.The text was updated successfully, but these errors were encountered: