Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mikael Axel Kleinwort 142 posts 487 karma points c-trib
    May 05, 2024 @ 05:21
    Mikael Axel Kleinwort
    0

    Access MCE's content item from within macro in MCE

    Scenario:

    I have a parent page ("Blog") with many children ("Blogpost"). Each blog post has a MCE property editor. Within this editor, I am using a macro which accesses data from the content item (blog post).

    This works fine when rendering the blog post itself which contains the macro. Inside the macro, I gain access to the blog post's data with through Model.

    However, when rendering the blog page, I loop through all blog post children to create a list of posts. Part of this list is rendering the MCE property of each child item.

    Problem:

    In this scenario, the macro inside of each child's MCE property fails, because in the macro, Model now resolves to the Blog page, rather than the Blog Post page which actually contains the MCE field with the macro inside.

    Question:

    So my question is: how can I access the blog post IPublishedContent item (which contains the MCE with the macro) from within the macro when the the MCE property with the macro is accessed from another page?

Please Sign in or register to post replies

Write your reply to:

Draft