Steps to reproduce:
- Set up a markup field
- Switch a Node types view mode to layout builder
- In lb ui for the view mode (e.g. /admin/structure/types/manage/article/display/default/layout) place a markup field in the content area
- The field shows in lb interface
- Save
- Open a node: Markup Field is not rendered
| Comment | File | Size | Author |
|---|
Issue fork markup-3059129
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anybodyI can confirm this problem! It is indeed incompatible, no content shows up on display.
The reason seems to be that all other fields become a field_block while this field type doesn't.
To be honest I have no clue why... This is a very very simple field and the field formatter seems OK to me...
Comment #3
anruetherSetting to major, because it blocks layout builder being used and we have no workaround. (if I understand priority levels correctly - maintainers aren't whatching anyways, but....)
At some point we might look into this more thouroughly, but I can't say when atm..
Comment #4
anybody@anruether: I still can't find the reason, this is really annoying. Did you have time to look into that?
viewElements() is definitely called, but the value is lost somewhere on its way ... I have no clue to be honest.
Comment #5
anybodyAfter searching for a solution for several hours I believe it's a core issue and not Markup modules fault. We're experiencing strange behaviour also for other fields like node links etc.
I hofe someome will find the reason soon, I'll stop my search now.
Comment #6
anruetherThanks for your research! Do you think we should move this to the core (layout builder) issue queue to get some more exposure? Do you want to add steps to reproduce for the node links issue you experienced or would that be a different issue?
Comment #7
anybody@anruether, perhaps it wouldn't be wrong to create a separate issue for layout builder in core issue que and reference this issue. First of all you should also have a look at that issue que, I couldn't find a matching issue. The node links issue might be different and is not that easy to reproduce and describe, because it doesn't appear for default view mode, so let's better keep this simple.
Furthermore we're already using two core patches which may have side-effects so I guess it's best to describe only THIS problem with a very simple default Drupal 8 installation after testing it before, for example on simplytest.me.
Anyway I'm not 100% sure it's a core issue, but have no more idea what might be wrong in Markup, which is a quite lightweight module...
Over and out :)
Comment #8
anruetherOk. See referencing issue.
Comment #9
tim.plunkettLayout Builder checks for emptiness before rendering fields, Field UI does not. I'll leave that debate to the other issue.
I think that Markup should probably act as a computed field, which would also address this bug (by using
\Drupal\Core\TypedData\ComputedItemListTraitBut in case that's not desirable, here's another approach
Comment #11
scottsawyerPatch worked well after a cache clear on markup:1.0.0-beta1 This solves a lot of headaches.
Comment #12
anybodyThank you very much @tim.plunkett! This indeed helped a lot. You're right that the static isEmpty => FALSE isn't perfect, instead it should be checked, if there is a result to return.
What do the maintainers think how to proceed here?
I'd also be OK with an RTBC here!
Comment #13
anybody@tim.plunkett: Thank you very very much for the patch!
I wanted to do a real check on emptiness and I think I was successful. Created a MR based on your patch and improved it afterwards, could you have a short look?
Tested it and it seems to work fine!
Comment #14
anybodyComment #15
anybodygrml, how I hate pushing to the wrong branch -.- sorry!
Here's the diff:
https://git.drupalcode.org/project/markup/-/merge_requests/3.diff
MR!3 is the one to review.
Comment #17
anybodyComment #18
anybodyAs this is major, I have positive internal feedback from my team and @tim.plunkett didn't have time yet to reply, I've decided to commit this and create a beta-4 release.
@tim.plunkett: Would still be nice to have your feedback, if you should have the time to have this 101% safe ;)
Comment #20
anybodyComment #21
anybodyComment #22
alexgreyhead commentedJust a note that the isEmpty() function on this doesn't check whether $this is an object:
The simplest fix might well be just:
... or perhaps better:
This is the issue which tracks the bug: https://www.drupal.org/project/markup/issues/3266122
Comment #23
anybodyThanks for pinging me @alexharries - I didn't see the regression issue. -.-
That was very helpful!
Comment #24
alexgreyhead commentedVery welcome, @Anybody - thank you for your time :-))
Best wishes
Alex