We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    I'm using Babel for a multilingual site. The site features a sidebar in which the user can place widgets. The widgets are resources themselves. The user can select them in a resource list tv. In this tv the parent is set to the container that holds the widget-resources.

    Problem is that I have a container with widgets for each language. However, in the resource list tv I can only set one ID, so for each language the widgets from that language are shown.

    Is there a way to make the parent in the resource list tv dynamic, and have it changed based on the context in which the resource that is being edited is in? I know how to get the context in the frontend, but I don't know if it's possible to get it in the backend, since it's always 'manager' there.

    This question has been answered by michelle84. See the first response.

    • discuss.answer
      • 19328
      • 433 Posts
      Didn't think this would work, but it did: in 'input option value' put this code:

      @EVAL if($modx->resource->get('context_key') == 'en') { return '12'; } else if($modx->resource->get('context_key') == 'de') { return '10'; } else { return '14'; }

        • 23214
        • 36 Posts
        Nice one! I had no idea you could do this either.

        In my case I wanted a Resource List which displayed all children of the resource being edited (imagine a field titled "Pick your favourite child"). This is as simple as adding this to the input value options:

        @EVAL return $modx->resource->get('id');