Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to insert a macro that will create dynamic content within RTE content. When viewing the page on the front end of the site, it simply displays the macro name.
I need it to be in the RTE grid component instead of a separate macro component so I can create dynamic content inline.
Think you're missing the attachment.
You're right. Thanks for the catch!
How are you rendering the macro?
I'm not. I'm using the default out of the box from Umbraco grid. The rendering is happening here /Views/Partials/Grid/Editors/Rte.cshtml
I can see where the view is parsing the umbraco internal links
var value = TemplateUtilities.ParseInternalLinks(Model.value.ToString(), Current.UmbracoContext.UrlProvider);
value = TemplateUtilities.ResolveUrlsFromTextString(value);
value = TemplateUtilities.ResolveMediaFromTextString(value);
but there isn't anything to convert the macros, which is why they aren't rendering.
I was attempting to use RteMacroRenderingValueConverter without having to build a VS Project. I'm trying to only use razor on this project for various reasons. There might be a way to do it, but I'm not familiar enough with how.
I hate to refer you to docs, but late here..
You still have to use a macro partial to render the macro, you can definitely do this in razor without VS or compiling anything: https://our.umbraco.com/documentation/reference/templating/macros/
There isn't a problem with the macro partial. The macros work outside of the grid RTE. It works in a regular RTE that is added to a document type via a property. It works in the grid when using the default macro component. Rendering a macro in the view with Umbraco.RenderMacro works.
My problem is specifically about displaying a macro in the RTE via grid and what code is needed to run the default Umbraco process to convert the code Umbraco places by default in RTE (below) to a rendered macro.
<div class="umb-macro-holder siteVariantLink umb-macro-mce_1 mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="siteVariantLink" firstUrl="test" secondUrl="second" thirdUrl="654" forthUrl="655" linkTitle="testtitle" openInNewWindow="0" /> --><ins>Macro alias: <strong>siteVariantLink</strong></ins></div>
I could write something to converts the macro name and moves all of the macro parameters to render the Umbraco.RenderMacro code, but it would be time-consuming. My hope was that the Umbraco API would have some type of utility that already did this.
It may not and if it's late there, you don't have to find an answer. Was just putting it out there to the masses.
Did anyone ever figure this out?
My case is that i'm trying to insert a Umbraco-forms macro via the RTE in a Perplex Contentblock.
The result HTML markup contains:
<div class="umb-macro-holder renderUmbracoForm umb-macro-mce_1 mceNonEditable">
<!-- the complete umbraco form commented out in HTML -->
[just the form labels without input elements]
Inserting the same macro via RTE outside the content blocks (or grid) works fine.
Unfortunately no, I never found a solution. I've just used the default "insert form" module for the grid.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted