- Issue created by @pdureau
- πΊπΈUnited States dalemoore
Here are my steps to reproduce. Some in the first steps sub-bullets may not be needed but including?
- You will need some SDCs to use. I have a parent SDC called Social Links and a child one called Social Link. (@pdureau should already have these, they were included in the Slack conversation)
- Make sure you have Display Suite and Display Suite Extras installed. This is used to select a component layout within Manage Display. Under Display Suite (admin/structure/ds/settings), I have these settings:
- Enable field templates
- Enable field templates in Layout Builder
- Default Field Template: Expert
- Under Extra fields, nothing selected
- Under Other, "Use field names in templates" and "Exclude Display Suite Layouts in Layout Builder" are checked"
- Nothing checked in BC settings
- Create a paragraph type (in my case, it's called Social Link - this is the child component) and add whatever fields you want to it, including at least one Entity Reference field (I have a taxonomy term one called Network that references social network names, e.g., Facebook, Instagram, etc.).
- Create a block type (in my case, it's called Social Links - this is the parent component) and add whatever fields you want, including one Entity Reference Revisions/Paragraphs field that uses the previously-created paragraph type.
- Go ahead and add an instance of the block somewhere on your page in a region (I'm not using Layout Builder here, just the block UI).
- Under Manage Display for the block type, make sure it's set to "Referenced entity" under Format for the Entity Reference Revisions field. That's all you need here.
- Under Manage Display for the paragraph type, with Display Suite installed, under "Current layout" select the SDC you want to use from the dropdown list (for me, it is the child component Social Link) and save.
- Go to "Layout settings" still in the paragraph type, and map the props to the appropriate fields. The only options to start are "Data from a field" or "Referenced entities", there is no initial "Prop: entity" available like there is when using "Components per item" in the sibling issue. π Introduce a new source to get access to the current "i-th" referenced entity from a field entity reference in the context of component per item field formatter Active I choose "Data from a field" for each.
- Once all fields are mapped, save, then go back and refresh the page to view your block.
- I get a ContextException error message.
Sending a video of the steps in Slack.
- π«π·France just_like_good_vibes PARIS
Thanks for reporting.
After investigation, this error occurs when using the contrib module ds, when a layout from ui patterns is configured in a content entity display (here a paragraph), and in the layout settings, a source with the current entity is used.
it works in form configuration, but fails to properly render.
Indeed, for the moment, ui_patterns module is not providing itself a way to guess the current entity inside ds_entity_view layout options. - π«π·France pdureau Paris
Indeed, for the moment, ui_patterns module is not providing itself a way to guess the current entity inside ds_entity_view layout options
UI Patterns target both Core & contrib modules, but we target by default only Core plugin types: Blocks, Layouts, Formatters...
Display Suite is using both:
- core plugin types (Layout for example) and it is supposed to work directly with
ui_patterns_layouts
sub-module if the usage of Dsipaly Suite is a "normal" (no weird additions or alteration) - a custom plugin type ("DS Field"), for this one,
ui_patterns_ds
is needed
So, are we 100% sure it is not working because of DS?
- If yes,
- we need to create an issue to https://www.drupal.org/project/issues/ui_patterns_ds β to deal with that.
- in our codebase, we need to make sure a fatal error is not triggered in those situations (not only with DS, more generic)
- If not, we need to tweak something in our codebase.
So, anyway, it seems there is something to do for the RC2.
- core plugin types (Layout for example) and it is supposed to work directly with
- πΊπΈUnited States dalemoore
a custom plugin type ("DS Field"), for this one, ui_patterns_ds is needed
To my knowledge I'm not using a DS Field, but I could be wrong. Would I have to select one of these options in the layout dropdown under Manage Display to do something like that?
Or, this option would need to be enabled maybe:
Or something on this screen?
I'm not sure what exactly a DS Field is, I haven't used the things found in the last two screenshots before. In the past I would only use what's in the first screenshot, which allows me to override the template, add attributes/classes to fields, etc.
The only thing I'm using DS in this case is to select an SDC on the Manage Display screen layout dropdown without having to rely on Layout Builder (because I don't wish to manipulate layout visually, just do mapping to the SDC) or Field Layout (this module is to be deprecated and will be removed from Core, see this issue π Inform users that Field Layout is deprecated Active , this issue π [META] Enable layout builder for form displays, and deprecate field_layout Postponed , and this issue π Move Field Layout data model and API directly into \Drupal\Core\Entity\EntityDisplayBase Needs work ). I haven't tried using Field Layout before, but I just did on a separate bare Drupal install. It doesn't seem to offer the ability to control field layout under "Manage display" any more, only under "Manage form display", so using Field Layout instead of Display Suite won't work.
- Merge request !326Issue #3500244 by dalemoore, pdureau, just_like_good_vibes: [2.0.0-rc2] ContextException with entity:paragraph β (Open) created by just_like_good_vibes
- π«π·France just_like_good_vibes PARIS
For the moment, let's catch context exceptions and send a message to drupal logs...
- π«π·France pdureau Paris
The change is great, thanks.
Before merging and closing the issue, we need to create the related issue in https://www.drupal.org/project/issues/ui_patterns_ds β
Do you want to do it?