Forum Discussion
Lindsey hard to say from the distance, maybe share the relevant parts of your code?
I noticed that I have a typo in my post above:
<#-- create a variable that holds the original component's markup --> <#assing markup> <@delegate /> </#assign>
should be
<#-- create a variable that holds the original component's markup --> <#assign markup> <@delegate /> </#assign>
of course, but most likely you got that, right?
and you say you get an error even if you directly output the contents of the markup variable, e.g:
<#-- create a variable that holds the original component's markup --> <#assign markup> <@delegate /> </#assign> <#-- add a regular HTML comment for debugging purposes --> <!-- START @override --> ${markup} <!-- END @override --> <#-- if you check the HTML markup of a page where your OOB component is displayed, you should find these comments when inspecting the component with the browser -->
?
This approach ONLY works for OOB components that are overwritten with @override, that means you create a NEW custom component with the EXACT name of the OOB one and postfix it with @override... e.g., <oob.component.name>@override will be the name of the component you put above code in... I assume you did that?
I was doing it for the profile hover card because I was trying to add the "send message" button to it. I'm not sure if this is an OOB component, but I called the file
theme-lib.ui-script.profile-card@override, and as a test I just tried to replace the arrow element with a paragraph saying TEST. Here is my code:
<#assign markup> <@delegate /> </#assign> <#assign markup = markup?replace('<i class="lia-fa lia-fa-angle-right"></i>', '<p>TEST</p>') /> ${markup}
This resulted in the error:
For "?replace" left-hand operand: Expected a string or something automatically convertible to string (number, date or boolean), but this has evaluated to a markup_output
Related Content
- 8 months ago
- 18 days ago
- 5 years ago