Copied to clipboard

Flag this post as spam?

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


  • René Pjengaard 118 posts 702 karma points c-trib
    Nov 20, 2019 @ 14:46
    René Pjengaard
    0

    How to add custom grid setup containing arrays

    Hi Kevin,

    first of all, super product you have #h5yr.

    In my solution i have som custom grid elements, which the default setup doesn´t translate.

    I´m trying to add them to the Translations.config file under mappers/grud/custom/

    I can´t find any documentation on setting up a custom grid-element containing arrays.

    { 
       "images":{ 
          "items":[ 
             { 
                "title":"Image title 1",
                "description":"",
                "imageId":1129,
                "link":null,
                "nocrop":false,
                "imageUrl":"/media/1001/maage-der-skutter-sig.jpg?width=250&height=156.25&mode=crop"
             },
             { 
                "title":"Image title 2",
                "description":"",
                "imageId":1130,
                "link":null,
                "nocrop":false,
                "imageUrl":"/media/1002/maage.jpg?width=250&height=156.25&mode=crop"
             }
          ]
       },
       "theme":{ 
          "alias":"white",
          "name":"White (default)",
          "color":"#fff"
       }
    },
    "editor":{ 
       "alias":"imagesTimes2AndTheme"
    }
    

    Can you help me in the right direction here? Ex. if i want to translate the properties in images.items[].title

    Best regards René

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Nov 21, 2019 @ 21:20
    Kevin Jump
    0

    Hi René

    Yes, the out of the box custom grid config doesn't really support values in arrays, so it might be that you need to write a custom mapper, to get those values out.

    the code for the Custom Grid Mapper is available here https://gist.github.com/KevinJump/a7754bb20f93b1e9934a8cbfb1bb9203

    so it might be that you can use this and expand it to support the array values, it's just not something that is in the core of translation manager at the moment.

    Kevin

  • René Pjengaard 118 posts 702 karma points c-trib
    Nov 22, 2019 @ 15:00
    René Pjengaard
    0

    Hi Kevin,

    thanks for the hint. My problem at the moment is, that it seems like the valueMapper is not getting registered. Where can i do that, and how do i trigger the mapper? Is it every time i send a node to translation?

    Best regards René

Please Sign in or register to post replies

Write your reply to:

Draft