Problem/Motivation
I am testing display_builder with a card SDC. If I enter a static value (textfield) as author that is being rendered when i check the view. But if I select the title of the referenced node (person content type), the title of the current page is shown.
I get no error messages. But if I select a field (field_firstname) from the referenced entity, I see
Entity node hda_display_builder has no field field_firstname
in the log.
Steps to reproduce
- Create blog and person content type
- Reference person via author field on blog content type
- Edit author mapping in
/admin/structure/types/manage/blog/display/card/display-builder, see config snippet below
Result:
- Open views page that lists blog card content: No title is shown
- Embed views block as slot in display override: Title of the current node is shown, e.g. Frontpage (not the referenced person node title)
third_party_settings:
display_builder:
profile: default
override_profile: default
override_field: field_blog_card
sources:
-
node_id: 699621109914b
source_id: component
source:
component:
component_id: 'hda_theme:blog_card'
variant_id: null
props:
blog_author:
source_id: entity_reference
source:
derivable_context: 'entity_reference:node:blog:field_author:node:person'
'entity_reference:node:blog:field_author:node:person':
value:
source_id: entity_field
source:
derivable_context: 'field:node:person:title'
'field:node:person:title':
value:
source_id: 'field_property:node:title:value'
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
anruetherComment #3
anruetherComment #4
pdureau commentedThanks @anruether for your detailed issue description. I am trying to reproduce the bug.
Comment #5
pdureau commentedSo, I have created:
personcontent type with afield_firstnameplain text fieldblogcontent type with afield_authorreference fieldI am building a display for blog content type (not
cardbutteaserbut must be the same:/admin/structure/types/manage/blog/display/teaser/display-builderWhen I visualize the rendered display (for example, from a View like you), I see that it is not
node:person:titlewhich is printed butnode:blog:title? Is it the same issue you have ?Also, if I use a field which exists only in
node:person(likefield_firstname), nothing is printed in rendered display but I have no log message about this.Can you tell me if we share the same understanding of the issue?
Comment #6
pdureau commentedComment #7
anruether@pdureau: I prepared a repo: https://gitlab.com/geeks4change/debug/debug_3574380 It includes:
Then do:
To trigger the error log entry
Comment #10
andres alvarez commentedThis is not a Display Builder bug. The cause is in ui_patterns: the child source resolves its
entitycontext to the first matching context, which is the current route node. On /blog it therefore reads the page node instead of the referenced entity, so the current node's title shows up, or "Entity not found in context" when there is no route node.It is already fixed on ui_patterns 2.0.x by #3626950 (commit b55538e7), which makes context selection prefer the context named like the definition. It is not in 2.0.21 yet, so it needs 2.0.x-dev. Verified against the blog/person recipe from the reproduction repository: with that commit applied, the author renders on /blog.
Nothing to change in Display Builder, so I suggest closing this as a duplicate of #3626950.
Comment #11
mogtofu33 commentedGreat, thanks for the review @andres-alvarez, so will be fixed in UI Patterns 2.0.22 release.