Copied to clipboard

Flag this post as spam?

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


  • Roy Berris 89 posts 577 karma points c-trib
    Nov 03, 2021 @ 08:29
    Roy Berris
    0

    Context aware property editors?

    Is there any way to make a multi node picker content aware?

    We have two websites (home nodes) with shared functionality. But we have two document types for each of the detail pages on each website because their content might be different. Now we have shared components, but some of there components have a multi node picker which picks those detail pages. Still following along?

    We have website Foo, and Bar.

    Foo
    -- FooNewsDetailPage
    -- FooBlogDetailPage
    Bar
    -- BarNewsDetailPage
    -- BarBlogDetailPage
    
    XComponent
    -- Multi Node Picker
    

    Now when I add the page component (element) to any of the pages, I want the multi node picker to be "context aware". When it is placed under Foo, it can only select the Foo type of pages. When it is placed under Bar it can only select the Bar detail pages.

    Right now the only solution I see is creating two components, which have the same backing code. But for the CMS are two different document types. FooXComponent which has the Foo document types in the multi node picker. And the same thing for Bar.

    But I am wondering if I can just keep the generic XComponent.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Nov 03, 2021 @ 10:47
    Nik
    0

    Hey Roy

    I'm not sure if you can limit it completely. But, on a Multi Node Tree Picker, you can use XPath to set a start location. If you use $site it starts at the root node of your site, in your example I think it would start at either Foo / Bar respectively.

    However, I don't know if that will stop you picking pages from the other sites or not, I've never tested it from that perspective.

    It should, however, take into account user permissions so if they cannot access Site Bar, they shouldn't be able to pick anything from it.

    Thanks

    Nik

  • Roy Berris 89 posts 577 karma points c-trib
    Nov 03, 2021 @ 10:56
    Roy Berris
    0

    Hey Nik,

    That doesn't seem to work. I've never worked with XPath before, but I see that it might be a solution.

    Do you know if I can go all the way up until I reach the first home page?

    Our structure looks like this

    Root Node
    -- Foo Homepage
    -- Bar Homepage
    

    Where both inherit from BaseHomePage. Is there a query that can do that? Or maybe go up until it reaches a node that inherits from BaseHomePage

  • Roy Berris 89 posts 577 karma points c-trib
    Nov 04, 2021 @ 12:18
    Roy Berris
    100

    For anyone in the future. This XPath query worked for me:

    $current[@isDoc]/ancestor-or-self::*[contains(@nodeName, 'Home')]
    
Please Sign in or register to post replies

Write your reply to:

Draft