When trying to figure out an error in Template Builder for EnableInlineEditingUI: Unable to determine the definition for field
I realized we simply had the wrong component and schema. But I'm trying to understand why part of this worked (fields display but XPath are missing).
The component template adds inline editing fields using <tcdl:ComponentField>
and RenderComponentField()
in the following (simplified) DWT:
<tcdl:ComponentField name="BannerImage">
<img tridion:type="Multimedia" alt="" src="@@BannerImage.ID@@">
</tcdl:ComponentField>
...
<h2>@@RenderComponentField("Heading", 0)@@</h2>
Run with the right Component that has BannerImage
, we correctly get:
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:BannerImage[1]"} -->
<img src="http://domain.com/Preview/8774535d-9fb0-43f7-a867-54674b217d85/image.png" alt="">
</span>
...
<h2>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:Description[1]"} -->Some Heading</span></h2>
It also partially worked for the wrong Component and different schema. The XPath's are missing but the fields actually render.
<span><!-- Start Component Field: {"XPath":"[1]"} -->
<img src="http://domain.com/Preview/dfc9a7e4-14c6-4a51-908b-3a77e13f518a/image.png" alt="">
</span>
...
<h2>
<span><!-- Start Component Field: {"XPath":"[1]"} -->Some Heading</span>
</h2>
Template builder shows (as expected since it's a different component):
EnableInlineEditingUI: Unable to determine the definition for field "BannerImage"
I think the fields display because the modular template adds both Components (with different schemas) to the package (each named "Component").
Out of curiosity and to make sure I understand this, how does RenderComponentField()
work? Does it match fields in any item named Component
in the package?