+1-888-365-2779
Try Now
More in this section

Forums / Thunder / Adding RelatedMediaField to Custom Module

Adding RelatedMediaField to Custom Module

6 posts, 1 answered
  1. Michael
    Michael avatar
    4 posts
    Registered:
    12 May 2014
    20 Mar
    Link to this post

    I am trying to add a RelatedMediaField to the detail control, and unable to determine how I should be getting a script reference to the control.

    If this was a widget designer there would be some changes to "GetScriptDescriptors" and the js file to wireup the control references, but the simpleview control for the custom module does not have that function.

    I wasn't able to find any kind of on init function I could tap into like the HtmlField control has, so I don't know how to wire it in.

     

    Answered
  2. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    23 Mar
    Link to this post
    Hello Michael,

    You can use SimpleScriptView instead of SimpleView to inherit from. SimpleScriptView implements IScriptControl interface which will give you access to GetScriptDescriptors and GetScriptReferences methods to wire up client side logic.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Michael
    Michael avatar
    4 posts
    Registered:
    12 May 2014
    24 Mar
    Link to this post

    that is what I was looking for, and based on sample code I have for widget designers I can take it the rest of the way.

    My remaining question is where is this documented? I suspect I missed it, but it seems the correct way to make a complete custom module is missing steps in the documentation.

  4. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    25 Mar
    Link to this post
    Hello Michael,

    We have an article that mentions the 2 base classes which you can inherit from when creating your own controls:

    http://docs.sitefinity.com/for-developers-create-a-new-custom-widget

    Sample implementation on SimpleScriptView:

    http://docs.sitefinity.com/image-selector-for-content-items-implement-the-server-widget

    Looking at those however I can see where the confusion comes from, so I have placed a Documentation enhancement request, so that we can provide a bit more information on those 2 classes in the first article as well as links to the different samples of their implementation, so that it can be found easier.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Michael
    Michael avatar
    4 posts
    Registered:
    12 May 2014
    29 Mar
    Link to this post

    Are there samples that cover how to take the thunder created simple view script file to work with a simplescriptview?

  6. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    29 Mar
    Link to this post
    Hello Michael,

    Thunder uses SimpleView as a base class for the controls it generates and for now there is no option to switch it to use SimpleScriptView.

    When you generate the control, just manually change that base SimpleView to SimpleScriptView and implement the required GetScriptDescriptors and GetScriptReferences methods

    I have attached a simple control implementing SimpleScriptView which you can check.

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
6 posts, 1 answered