Copied to clipboard

Flag this post as spam?

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


  • Chester Campbell 98 posts 209 karma points
    Mar 10, 2021 @ 22:12
    Chester Campbell
    0

    Tactics for migrating RTE into a Grid Layout property

    Hi,

    I'm running CMSImport 4.1.1 to import JSON files into an Umbraco 8.11.1 instance.

    The JSON files are created by a custom export tool in an Umbraco 7.4.4 site.

    I have an RTE property that needs to be imported into a Grid Layout property on the new site. The Grid Layout on the new site is going to be the same for every content item so my initial attempt was to render out the properly formatted JSON during my custom export from the Umrbaco 7.4.4 site.

    CMSImport just imports this as a string to the new site. And it does insert properly and the 8.11.1 CMS does recognize it properly.

    However, none of the media embedded in the RTE get imported. I'm not really surprised by this as I'm guessing CMSImport recognizes the string as JSON and does not attempt to parse it.

    So my question is would it be appropriate for me to build a custom FieldProvider that parses the string and handles the embedded media? And if I went that route would I need to set the fieldProviderOptions.Break property?

    Or is there another tactic to accomplish what I need that I'm not thinking of?

    Thanks!

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Mar 11, 2021 @ 07:27
    Richard Soeteman
    100

    Hi Chester,

    Grid Support is not supported by CMSImport since it's a definition of it's own so you don't need to set Break options.

    The thing you need to do is return a string that exactly matches the JSON string how it will be stored in the database table.

    For media import you can inject IMediaImport interface in your constructor of the Fieldprovider and use

    _mediaImport.Import(relative path to file, parent udi for image folder ), parent udi for files folder, the user id to use,  ShowErrorWhenMissing boolean)
    

    That will give you a list of mediaimport result with id's you can use in your JSON object.

    Hope this helps,

    Richard

  • Chester Campbell 98 posts 209 karma points
    Mar 12, 2021 @ 00:13
    Chester Campbell
    0

    Hi Richard,

    I got it working. I ended up creating a FieldProvider and also an AdvancedSettingProvider and AdvancedSettingOptions so that I could set the media root node and toggle the "break on missing items" flag. Works perfectly!

    Thanks for your help! Cheers

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Mar 12, 2021 @ 07:28
    Richard Soeteman
    0

    Nice Chester, I think you are the first person creating a custom advanced settings provider :-)

Please Sign in or register to post replies

Write your reply to:

Draft